Subject: Re: [xsl] XSL resources - Flat to hierarchy - Common ancestors From: David Carlisle <davidc@xxxxxxxxx> Date: Tue, 27 Jul 2004 11:08:08 +0100 |
<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 ________________________________________________________________________
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] XSL resources - Flat to h, M. David Peterson | Thread | RE: [xsl] XSL resources - Flat to h, Ben Simkins |
Re: [xsl] XSL resources - Flat to h, M. David Peterson | Date | RE: [xsl] can you select name() of , Michael Kay |
Month |