Charlie Kaiman wrote:
I need
to separate the following data into separate fields:
<years title = "year">1994, 1995, 1996,
1997, 1998, 1999, 2000, 2001, 2002, 2003,
</year>
For
instance, the output needs to read:
<tr><td>1994</td><td>1995</td><td>1996</td>
... etc ... </tr>
--------------------
It
should be possible using recursive named template calls, something
like
<xsl:template
name="displayyear">
<xsl:param
name="yearlist">
<xsl:variable name="year"
select="substring-before($yearlist,',')"/>
<xsl:choose>
<xsl:when
test="string-length($year) > 0">
<td><xsl:value-of select="$year"/></td>
<xsl:call-template name="displayyear">
<xsl:with-param name="yearlist"><xsl:value-of
select="substring-after($yearlist,',')"/></xsl:with-param>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<td><xsl:value-of
select="$displayyear"/></td>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
However, since the XML Schema list datatypes only
support space-separated lists, you may want to consider changing your source
document to not use comma delimiters.