This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: Alternate bg colors for table and address summaries
- To: <xsl-list at mulberrytech dot com>
- Subject: RE: Alternate bg colors for table and address summaries
- From: "Joerg M. Colberg" <joerg dot colberg at econovo dot com>
- Date: Thu, 2 Nov 2000 17:27:50 -0400 (EST)
- Reply-To: xsl-list at mulberrytech dot com
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