xsl-list
[Top] [All Lists]

Re: [xsl] recursive loop in XSL stylesheet is failing

2010-03-25 16:20:25
On 25/03/2010 20:38, George wrote:
There is one tiny little bit that I want to change. On the output the
categories start with a colon:
<xsl:stylesheet version="1.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>&#10;</xsl:text>
<xsl:value-of select="Date"/>
<xsl:text>;</xsl:text>
<xsl:variable name="cid" select="CategoryID"/>
<xsl:for-each select="$c">
<xsl:apply-templates select="key('c',$cid)"/>
</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:variable name="cid" select="@ParentID"/>
<xsl:for-each select="$c">
 <xsl:apply-templates select="key('c',$cid)"/>
 <xsl:if test="key('c',$cid)">:</xsl:if>
</xsl:for-each>
 <xsl:value-of select="en"/>
</xsl:template>

</xsl:stylesheet>


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--