While traveling from Cologne to Schwelm I was working on a xsl stylesheet that produces odd/even rows for a list view. Oh, you say: "Not really hard to implement! Why do you blog about such stuff?" Either I am totally blind or the odd/even topic is really hard to solve problem for recursive, tree like structures, so please: "repeat this answer/question for the following xsl fragment"
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<xsl:template name="is.odd.or.even">
<xsl:param name="c" select="1" />
<xsl:param name="n" select="." />
<xsl:choose>
<xsl:when test="name($n) = 'testcase' and $n/preceding-sibling::*">
<xsl:call-template name="is.odd.or.even">
<xsl:with-param name="c" select="$c + 1" />
<xsl:with-param name="n" select="$n/preceding-sibling::*[1]" />
</xsl:call-template>
</xsl:when>
<xsl:when test="name($n) = 'testsuite' and $n/preceding-sibling::*">
<!-- Get preceding node -->
<xsl:variable name="preceding" select="$n/preceding-sibling::*[1]" />
<!-- Count child nodes of preceding -->
<xsl:variable name="child.count" select="count($preceding//testcase) +
count($preceding//testsuite)" />
<xsl:call-template name="is.odd.or.even">
<xsl:with-param name="c" select="$c + 1 + $child.count" />
<xsl:with-param name="n" select="$preceding" />
</xsl:call-template>
</xsl:when>
<xsl:when test="(name($n) = 'testcase' or name($n) = 'testsuite') and contains($n/../@name, '::')">
<xsl:call-template name="is.odd.or.even">
<xsl:with-param name="c" select="$c + 1" />
<xsl:with-param name="n" select="$n/.." />
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:if test="$c mod 2 = 1">
<xsl:text>oddrow</xsl:text>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>