Re: XSL resources - Flat to hierarchy - Common ancesto
<xsl:for-each select="msxsl:node-set($menus)"> node-set always makes a set containing _one_ element only so this for-each isn't going to iterate very much. The result tree fragment made by <xsl:variable name="menus"> <xsl:apply-templates select="Menus"/> </xsl:variable> has a single top level node / (like an input document) and below that it has whatever elements are made by applying templates to Menus so when that is made into a node set you get a set consisting of a single / node. If you apply templates to that, then the template that matches will be this one: <xsl:template match="/"> <xsl:variable name="menus"> <xsl:apply-templates select="Menus"/> </xsl:variable> <xsl:for-each select="msxsl:node-set($menus)"> <xsl:copy> <xsl:copy-of select="@*"/> <xsl:attribute name="TOC"> <xsl:number level="multiple" format="1.1"/> </xsl:attribute> </xsl:copy> </xsl:for-each> </xsl:template> and you'll go into an infinite loop and die. So instead do <xsl:for-each select="msxsl:node-set($menus)/*"> ^^^ so you apply templates to the elements below / not to the / node. I doubt that there is anyone on this list who's used node-set before who hasn't made this mistake at least once (except Jeni of course:-) I've done it thousands of times... David ________________________________________________________________________ This e-mail has been scanned for all viruses by Star Internet. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________
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