Subject: RE: Dynamic Menu Using XSL
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Mon, 11 Dec 2006 23:47:42 -0000
|
So are you saying you want to invoke a client-side transformation that
changes the page in response to user input? That's doable, but we need to
understand your processing model. The main issue with client-side
transformation is making it work cross-browser - again, that's doable, but
one needs to understand the requirements so that you can use the right API.
Michael Kay
> -----Original Message-----
> From: Brant Schroeder [mailto:brantschr@xxxxxxxxx]
> Sent: 11 December 2006 22:59
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: Re: Dynamic Menu Using XSL
>
> Micheal,
> I already know how I would like the HTML to look. The
> XSLT is currently applying the HTML format I would like to
> have. I would like to however construct the HTML via the
> XSLT depending on the page selected.
>
> Example of Home being selected
>
> <ul>
> <li class="selected"><a href="default.aspx">Home</a></li>
> <li><a href="training.aspx">Training</a></li>
> <li><a href="othertraining.aspx">Other Training</a></li>
> <li><a href="aboutus.aspx">About Us</a></li> </ul>
>
> Example of Training being selected
>
> <ul>
>
> <li><a href="default.aspx">Home</a></li>
>
> <li class="selected"><a href="training.aspx">Training</a>
> <ul>
>
> <li><a href="#">Search Training</a></li>
> <li><a href="#">Post Training</a></li>
> </ul>
> </li>
>
> <li><a href="othertraining.aspx">Other Training</a></li>
>
> <li><a href="aboutus.aspx">About Us</a></li>
>
> </ul>
>
> Example of sub page of Training being selected
>
>
>
> <ul>
>
>
> <li><a href="default.aspx">Home</a></li>
>
>
> <li><a href="training.aspx">Training</a>
>
> <ul>
>
>
> <li class="selected"><a href="#">Search Training</a></li>
>
> <li><a href="#">Post Training</a></li>
>
> </ul>
>
> </li>
>
>
> <li><a href="othertraining.aspx">Other Training</a></li>
>
>
> <li><a href="aboutus.aspx">About Us</a></li>
>
>
> </ul>
>
> I would like to use the url as the parameter that defines
> what page is picked.
>
> Thanks
> Brant
>
>
> ----- Original Message ----
> From: Michael Kay <mike@xxxxxxxxxxxx>
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Sent: Monday, December 11, 2006 11:19:26 AM
> Subject: RE: Dynamic Menu Using XSL
>
> 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: 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.
>
>
>
>
>
>
>
> ______________________________________________________________
> ______________________
> Want to start your own business?
> Learn how on Yahoo! Small Business.
> http://smallbusiness.yahoo.com/r-index
|