I am beginning to think that the problem isn't with the banding code. Somehow count is not coming out correct. Could it be in either the xml, I have approx. 150 of the case-study nodes? Or can it be in the order in which I am doing the for-each and the if?
<!-- XML -->
<case-studies>
<case-study>
<name>Company A</name>
<solutionType>Mobility</solutionType>
<solutionType>Convergence</solutionType>
<solution category="Business services">Product</solution>
<solution category="Business services">Industry</solution>
<solution category="#">A-Z</solution>
<product>Product 1</product>
</case-study>
</case-studies>
I am trying to create a table that alternates gray rows within the for-each. The code below returns an eratic effect.
Thanks
<xsl:sort select="../name" />
<xsl:if test="@category[. = $solName]">
<tr>
<xsl:if test="(position() mod 2 = 1)">
<xsl:attribute name="bgcolor">#e7e7e7</xsl:attribute>
</xsl:if>
<td class="cell1">
<img src="/images/icons/infoWhite.gif" style="margin:3px 3px 0 0px;" id="{../name}" onmouseover="xstooltip_show('{../url}', '{../name}', 0, 10);" onmouseout="xstooltip_hide('{../url}');" />
<div id="{../url}" class="xstooltip" style="margin:10px 0 0 10px;">
<div class="floatLeft"><strong>Product(s):</strong></div>
<div class="margLeft10 floatLeft">
<xsl:for-each select="../product/prodName">
<div class="clearRight"><xsl:value-of select="."/></div>
</xsl:for-each>
</div>
</div>
</td>
<td class="cell2" style="padding-top:2px;">» <a href="{../url}"><xsl:value-of select="../name"/></a></td>
<td class="cell3">
<xsl:for-each select="../solutionType">
<div class="clearRight"><xsl:value-of select="."/></div>
</xsl:for-each>
</td>
</tr>
</xsl:if>
</xsl:for-each>