R
Ralph Snart
i'm trying to do the classic alternating table row colors trick.
i can't use position() mod 2 in this case because sometimes the
template is called but it decides not to print the particular element.
i really need to keep track of how many times it has printed something,
but since you can't modify variables in xslt, i have no idea how to
do it.
the fragment looks something like this:
<xsl:template match="story">
<xslaram name="no_repeats"/>
<xsl:if test="following-sibling::*[1]/id != id or position() = last() or $no_repeats != 1">
<tr>
<xsl:attribute name="class">
<xsl:choose>
<xsl:when test="position() mod 2 = 0">dark</xsl:when>
<xsltherwise>light</xsltherwise>
</xsl:choose>
</xsl:attribute>
<td>
any ideas?
-rs-
i can't use position() mod 2 in this case because sometimes the
template is called but it decides not to print the particular element.
i really need to keep track of how many times it has printed something,
but since you can't modify variables in xslt, i have no idea how to
do it.
the fragment looks something like this:
<xsl:template match="story">
<xslaram name="no_repeats"/>
<xsl:if test="following-sibling::*[1]/id != id or position() = last() or $no_repeats != 1">
<tr>
<xsl:attribute name="class">
<xsl:choose>
<xsl:when test="position() mod 2 = 0">dark</xsl:when>
<xsltherwise>light</xsltherwise>
</xsl:choose>
</xsl:attribute>
<td>
any ideas?
-rs-