RE: [xsl] Dynamic Menu Using XSL

Subject: RE: [xsl] Dynamic Menu Using XSL
From: "XSLList" <XSLList@xxxxxxxxxx>
Date: Tue, 12 Dec 2006 13:16:32 -0000
Brant,

This is not complicated.

When you generate an HTML page by whatever method the page is sent to the
browser and is then not in any way connected to the Server that created the
page.

You can disconnect from the Internet and your browser will still "see" the
web page. When you then click a link on the page your browser will attempt
to reconnect to the server for your request.

Therefore if you need different XSLs to be invoked for different "pages" you
will need to handle this server-side. You can use one page and pass a
parameter via a querystring item or use different pages with a different XSL
associated with each page.

There is a caveat which I'm sure other Listers will notice. I am ignoring
AJAX as I guess this would be too complex an issue to include at this stage.

If you truly want to carry out different transformations (using different
XSL files client-side then Ajax is the way to go and this thread will
continue.

Welcome to stateless computing.

William Charlton
The yMonda team
yMonda Limited
w: www.ymonda.net

-----Original Message-----
From: Brant Schroeder [mailto:brantschr@xxxxxxxxx] 
Sent: 2006 December 12 00:26
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [xsl] Dynamic Menu Using XSL

Well I just lost now so I think I will just try a different less efficient
route.
thanks
Brant

----- Original Message ----
From: Michael Kay <mike@xxxxxxxxxxxx>
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Sent: Monday, December 11, 2006 3:47:42 PM
Subject: RE: [xsl] Dynamic Menu Using XSL

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: [xsl] 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: [xsl] 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: [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.
> 
> 
> 
> 
> 
> 
>  
> ______________________________________________________________
> ______________________
> Want to start your own business?
> Learn how on Yahoo! Small Business.
> http://smallbusiness.yahoo.com/r-index






 
____________________________________________________________________________
________
Yahoo! Music Unlimited
Access over 1 million songs.
http://music.yahoo.com/unlimited

Current Thread