Subject: RE: Alternate bg colors for table and address summaries
From: "Joerg M. Colberg" <joerg.colberg@xxxxxxxxxxx>
Date: Thu, 2 Nov 2000 17:27:50 -0400 (EST)
|
Paul Essex wrote:
> [...]
> Take a look at page 367 in Michael Kay's XSLT book. The very
> last entry in
> the Examples table shows this method of determining whether a node's
> position is even:
>
> item[position() mod 2 = 0]
>
> Use this in an xsl:when test something like this:
>
> <xsl:choose>
> <xsl:when test="Summary[position() mod 2 = 0]>
> <xsl:call-template name="bgcolorgrey"/>
> </xsl:when>
> <xsl:otherwise>
> <xsl:call-template name="bgcolorwhite"/>
> </xsl:otherwise>
> </xsl:choose>
I think I'd use stylesheets. Then, your could do something like
<tr>
<xsl:choose>
<xsl:when test="Summary[position() mod 2 = 0]>
<xsl:attribute name="class"/>bgcolourblack</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="class"/>bgcolourblack</xsl:attribute>
</xsl:otherwise>
</xsl:choose>
<!-- all the other stuff for the row -->
</tr>
- Joerg
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|