Subject: Re: [xsl] Need Help From: David Carlisle <davidc@xxxxxxxxx> Date: Fri, 8 Dec 2006 23:55:40 GMT |
(please see the list posting guidelines about choosing subject lines that help the archives later) > I want to transform it to this > .. > Is this possible? not exactly as your requested format isn't well formed (<a> elements not closed) but essentially I suspect you want something like <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output indent="yes"/> <xsl:template match="menu"> <ul> <xsl:apply-templates/> </ul> </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> which produces <ul> <li> <a href="#">Home</a> </li> <li> <a href="#">My Stuff</a> <ul> <li> <a href="#">Backgrounds</a> </li> <li> <a href="#">Flyers</a> </li> <li> <a href="#">Posters</a> </li> </ul> </li> <li> <a href="#">Portfolio</a> <ul> <li> <a href="#">Backgrounds</a> </li> <li> <a href="#">Flyers</a> </li> <li> <a href="#">Posters</a> </li> <li> <a href="#">More Information</a> <ul> <li> <a href="#">Resume</a> </li> <li> <a href="#">Contact Me</a> </li> </ul> </li> </ul> </li> </ul> > Also I would like to apply CSS Classes to certain nodes depending if > they are selected or not. selected by what, where? > And can I hide child nodes if the p=arent node is not selected? xslt doesn't interact with the browser at all (even if you are using a client side xslt that's in the browser) it just generates an html page that is then rendered, so if you know what css and/or javascript you need to get whatever dynamic effect that you want, then you can generate that code in xslt, but xslt doesn't "know" anyting about css or javascript (or html) it's just generating an element tree, and the javascript is just text as fas as xslt is concerned. David
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Need Help, Brant Schroeder | Thread | RE: [xsl] Need Help, cknell |
Re: [xsl] Referencing unique values, David Carlisle | Date | Re: [xsl] Referencing unique values, Andreas Kemkes |
Month |