Yep, thanks for the xslt code snippet! Only a few adjustments so that the tbody is not necessary and the rest of the html is copied again:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="table/@alternate" /> <xsl:template match="[EMAIL PROTECTED] ='true']"> <table> <xsl:copy-of select="@*"/> <xsl:apply-templates select="tr" mode="alternate"/> </table> </xsl:template> <xsl:template match="tr" mode="alternate"> <xsl:copy> <xsl:apply-templates select="@*" /> <xsl:attribute name="class"> <xsl:choose> <xsl:when test="position() mod 2 = 1"> <xsl:text>GridRowOdd</xsl:text> </xsl:when> <xsl:otherwise> <xsl:text>GridRowEven</xsl:text> </xsl:otherwise> </xsl:choose> </xsl:attribute> <xsl:apply-templates select="node() | @*" /> </xsl:copy> </xsl:template> <xsl:template match="@*|node()" priority="-1"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template> </xsl:stylesheet> Regards, Gunter Mark Lundquist <[EMAIL PROTECTED]> 13/10/2005 10:07 Please respond to users@cocoon.apache.org To users@cocoon.apache.org cc Subject FW_SPAM: Re: repeaters & alternate row colours On Oct 13, 2005, at 1:02 AM, Gunter D'Hondt wrote: > as Jorg also mentoined; I'm still using 2.1.4 (and cannot upgrade that > quickly) so as far as I know I can't use the jx macros in that version > any other possibilities? Sure. I use XSLT for this, that way I can get this effect for any table I want, not just repeaters. E.g., <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="table/@alternate" /> <xsl:template match="[EMAIL PROTECTED] ='true']/tbody"> <tbody> <xsl:apply-templates select="tr" mode="alternate"/> </tbody> </xsl:template> <xsl:template match="tr" mode="alternate"> <xsl:copy> <xsl:apply-templates select="@*" /> <xsl:attribute name="class"> <xsl:choose> <xsl:when test="position() mod 2 = 1"> <xsl:text>odd</xsl:text> </xsl:when> <xsl:otherwise> <xsl:text>even</xsl:text> </xsl:otherwise> </xsl:choose> </xsl:attribute> <xsl:apply-templates select="node() | @*" /> </xsl:copy> </xsl:template> </xsl:stylesheet> HTH, —ml— --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]