R
Ralph Snart
Is there a way to alternate table row colors without using the
position() mod 2 trick? I'm in a series of nested xsl:for-each
elements, about 3 deep, and I want to alternate the table row
color all the way through. position() resets to 1 whenever
the inner for-each loops around, of course.
Example code:
<xsl:for-each select="/games/game[count(. | key('platforms', platform)[1]) = 1]">
<xsl:sort select="platform"/>
<xsl:variable name="platform" select="platform"/>
<xsl:for-each select="/games/game[date = $date][region = $region][platform = $platform]">
<xsl:sort select="title"/>
<tr class="???????" bgcolor="???????">
<td>
<xsl:choose>
<xsl:when test="position() = 1"><xsl:value-of select="platform"/></xsl:when>
<xsltherwise> </xsltherwise>
</xsl:choose>
</td>
<td><a href="{path}/data/{id}.html"><xsl:value-of select="title"/></a></td>
<td><xsl:value-of select="genre"/></td>
</tr>
</xsl:for-each>
</xsl:for-each>
-rs-
position() mod 2 trick? I'm in a series of nested xsl:for-each
elements, about 3 deep, and I want to alternate the table row
color all the way through. position() resets to 1 whenever
the inner for-each loops around, of course.
Example code:
<xsl:for-each select="/games/game[count(. | key('platforms', platform)[1]) = 1]">
<xsl:sort select="platform"/>
<xsl:variable name="platform" select="platform"/>
<xsl:for-each select="/games/game[date = $date][region = $region][platform = $platform]">
<xsl:sort select="title"/>
<tr class="???????" bgcolor="???????">
<td>
<xsl:choose>
<xsl:when test="position() = 1"><xsl:value-of select="platform"/></xsl:when>
<xsltherwise> </xsltherwise>
</xsl:choose>
</td>
<td><a href="{path}/data/{id}.html"><xsl:value-of select="title"/></a></td>
<td><xsl:value-of select="genre"/></td>
</tr>
</xsl:for-each>
</xsl:for-each>
-rs-