Subject: RE: [xsl] Dynamic Menu Using XSL From: "Michael Kay" <mike@xxxxxxxxxxxx> Date: Mon, 11 Dec 2006 19:19:26 -0000 |
Remember that XSLT is used to generate the target HTML page, and if you want any interaction on that page, e.g. hiding things when other things are selected, that's purely a question of generating the HTML that exhibits that behaviour. So it's a two-stage process: (a) design the (dynamic) HTML that you want to display (b) design the XSLT that generates it from your source XML. I get the impression you haven't separated the two stages. It's a good idea not to start on (b) until you have completed (a). Michael Kay http://www.saxonica.com/ > -----Original Message----- > From: Brant Schroeder [mailto:brantschr@xxxxxxxxx] > Sent: 11 December 2006 18:01 > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > Subject: [xsl] Dynamic Menu Using XSL > > I am trying to create a dynamic menu using XML and XSLT. > Here is my XML > > <?xml version="1.0" encoding="iso-8859-1" ?> <?xml-stylesheet > type="text/xsl" href="mymenu.xsl"?> > > > <menu> > <item id = "1" url="default.aspx" title="Home"></item> > <item id = "2" url="default.aspx?id=Training" > title="Training"> > <item id = "3" > url="default.aspx?id=Search_Training" title="Search Training"></item> > <item id = "4" > url="default.aspx?id=Post_Training" title="Post > Training"></item> > </item> > <item id = "7" url="default.aspx?id=Other_Training" > title="Other Training"> > <item id = "8" > url="default.aspx?id=Search_Other_Training" title="Search > Other Training"></item> > <item id = "9" > url="default.aspx?id=Post_Other_Training" title="Post Other > Training"></item> > </item> > <item id = "11" url="default.aspx?id=About_Us" > title="About Us"> > <item id = "12" url="default.aspx?id=Location" > title="Location"> > <item id = "13" > url="default.aspx?id=Map" title="View Map"></item> > </item> > </item> > </menu>I am using the following XSLT to generate my HTML > > <?xml version="1.0" encoding="utf-8"?> > > > > <xsl:param name="URL"/> > > <xsl:output indent="yes"/> > <xsl:template match="menu"> > <html> > <body> > <ul> > <xsl:apply-templates/> > </ul> > </body> > </html> > </xsl:template> > <xsl:template match="item"> > <li> > <a href="{@url}"> > <xsl:value-of select="@title"/> > </a> > <xsl:if test="item"> > <ul> > <xsl:apply-templates/> > </ul> > </xsl:if> > </li> > </xsl:template> > > </xsl:stylesheet> > > I would like to hide the child menu if the parent menu is not > selected. I would also like the parent menu to be expanded > if a child menu is selected. I am passing the url as a > parameter (ex: default.aspx, default.aspx?id=About_us) this > matches the URL attribute of the item. I am new to XSLLT > and would appreciate any help. > > Thanks > Brant > > > > > > ______________________________________________________________ > ______________________ > Any questions? Get answers on any topic at > www.Answers.yahoo.com. Try it now.
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Dynamic Menu Using XSL, Brant Schroeder | Thread | Re: [xsl] Dynamic Menu Using XSL, Brant Schroeder |
[xsl] the best approach, Sam Carleton | Date | Re: [xsl] Problem getting margin-to, J.Pietschmann |
Month |