RE: [xsl] Different Colors for Alternating Rows

Subject: RE: [xsl] Different Colors for Alternating Rows
From: Americo Albuquerque <melinor@xxxxxxx>
Date: Tue, 1 Jul 2003 18:42:22 +0100
Hi

> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of 
> Schwartz, Rechell R, ALABS
> Sent: Tuesday, July 01, 2003 1:36 PM
> To: kjjones@xxxxxxxxxxxx; xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: RE: [xsl] Different Colors for Alternating Rows
> 
> 
> Kevin,
> 
> This time I didn't get the error and the performance was 
> excellent (only about 6 seconds), BUT every row came out with 
> the oddStyle. Any clue what is wrong?
> 

In your <xsl:template name='copytr'> change <xsl:when test="$even=true()">
to <xsl:when test="$even='true'"> and it might work (just in case you missed
the line I'm writing the complete template in the end of this email)

That happens because $even is bound to the value of a string attribute and
here you are comparing its value with true, so the result will always be
false and you'll get all oddStyle.


<xsl:template name='copytr'>
 <xsl:param name='node' select='.'/>
 <xsl:param name='inset'/>
 <xsl:param name='even'/>

 <xsl:for-each select='$node'>
  <xsl:copy>
   <xsl:choose>
    <xsl:when test="$inset">
    <xsl:choose>
     <!-- the next line has changed -->
     <xsl:when test="$even='true'">
     <td class="evenMedium" width="35%"><xsl:apply-templates
select="td[1]/node()|td[1]/@*"/></td>
     <td class="evenMedium" width="65%"><xsl:apply-templates
select="td[2]/node()|td[2]/@*"/></td>
     </xsl:when>
     <xsl:otherwise>
     <td class="oddMedium" width="35%"><xsl:apply-templates
select="td[1]/node()|td[1]/@*"/></td>
     <td class="oddMedium" width="65%"><xsl:apply-templates
select="td[2]/node()|td[2]/@*"/></td>
     </xsl:otherwise>
    </xsl:choose>
    </xsl:when>
    <xsl:otherwise>
    <xsl:apply-templates select="node()|@*"/>
    </xsl:otherwise>
   </xsl:choose>
  </xsl:copy>
 </xsl:for-each>
</xsl:template>




 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread