Subject: Re: [xsl] recursive loop in XSL stylesheet is failing From: Martin Honnen <Martin.Honnen@xxxxxx> Date: Thu, 25 Mar 2010 20:05:42 +0100 |
Thanks a lot guys in order to shed light on my view about variables!!
Great, thank you very much David for the modified stylesheet.
Unfortunately it does not give the result I expected. It stops after the output of Date. It seems that it does not like the key() function.
Are you sure that it is called correctly this way: > <xsl:apply-templates select="key('c',CategoryID,$c)"/>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:key name="c" match="Category" use="@ID"/> <xsl:variable name="c" select="document('Categories.xml')"/> <xsl:template match="Entry"> <xsl:text> </xsl:text> <xsl:value-of select="Date"/> <xsl:apply-templates select="key('c',CategoryID,$c)"/>
Change the above line to <xsl:variable name="cat" select="CategoryID"/> <xsl:for-each select="$c"> <xsl:apply-templates select="key('c', $cat)"/> </xsl:for-each>
<xsl:text>;</xsl:text> <xsl:value-of select="Recipient"/> <xsl:text>;</xsl:text> <xsl:value-of select="Value"/> </xsl:template>
<xsl:template match="Category"> <xsl:apply-templates select="key('c',@ParentID,$c)"/>
and the above line to <xsl:variable name="pid" select="@ParentID"/> <xsl:for-each select="$c"> <xsl:apply-templates select="key('c', $pid)"/> </xsl:for-each>
Martin Honnen http://msmvps.com/blogs/martin_honnen/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] recursive loop in XSL sty, George | Thread | Re: [xsl] recursive loop in XSL sty, George |
Re: [xsl] recursive loop in XSL sty, George | Date | Re: [xsl] recursive loop in XSL sty, George |
Month |