[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Need Help
(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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|