XSL transformation
I have the following xsl file but when I apply it to a recordset I get more than once (actually the number of recorset rows) the stuff that were supposed to be displayed based on the first template (t1)
(for example <title>case1case1case1</title> if the recordset has 3 rows). Instead I expect to have <title>case1</title>.
The xsl follows:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:rs="urn:schemas-microsoft-com:rowset"
xmlns:z="#RowsetSchema"
xmlns:rss="http://purl.org/rss/0.91">
<xsl:output encoding="UTF-8" />
<xsl:template match="/">
<rss version="0.91">
<xsl:apply-templates/>
</rss>
</xsl:template>
<xsl:template match="rs:data">
<channel>
<title><xsl:apply-templates select="z:row" mode="t1"/>
</title>
<xsl:apply-templates select="z:row" mode="t2"/>
</channel>
</xsl:template>
<xsl:template name="t1" match="z:row" mode="t1">
<xsl:choose>
<xsl:when test="@case = '1'"><xsl:text>case1</xsl:text></xsl:when>
<xsl:when test="@case = '2'"><xsl:text>case2</xsl:text></xsl:when>
<xsl:otherwise><xsl:text>NO case found</xsl:text></xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="t2" match="z:row" mode="t2">
<item>
<description><xsl:value-of select="@last_inserted"/></description>
</item>
</xsl:template>
</xsl:stylesheet>
Any ideas?!
Thanks in advance,
Theodore.
|