This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Changing row colors using variables
- To: "'xsl-list at lists dot mulberrytech dot com'" <xsl-list at lists dot mulberrytech dot com>
- Subject: [xsl] Changing row colors using variables
- From: Steve Kuntz <SKuntz at CooperVision dot com>
- Date: Wed, 7 Nov 2001 16:14:38 -0500
- Reply-To: xsl-list at lists dot mulberrytech dot com
<xsl:attribute name="bgcolor">
<xsl:if test="@t_orno != preceding-sibling::row[1]/@t_orno">
<xsl:choose>
<xsl:when test="$currentRowColor='#EFFFFF'">
$currentRowColor=#FFFFFF
</xsl:when>
<xsl:otherwise>
$currentRowColor=#EFFFFF
</xsl:otherwise>
</xsl:choose>
</xsl:if>
<xsl:value-of select="$currentRowColor"/>
</xsl:attribute>
I have a variable name currentRowColor...if the value of t_orno is not the
same as t_orno in the preceding row, I want to switch row colors in my
grid...that way all rows of the same "t_orno" field will be colored
together. This code acts funny though, depending on where I put single
quotes...if I don't put the single quotes around #EFFFFF in the test
statement, it does not work...adding quotes around the variable assignment
like so: $currentRowColor='#EFFFFF' changes the color. I don't think I am
assigning the variables correctly, because the test condition does not
always work correctly.
--Steve Kuntz
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list