xsl-list
[Top] [All Lists]

RE: Different Colors for Alternating Rows

2003-07-01 10:42:22
Hi

-----Original Message-----
From: owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com 
[mailto:owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com] On Behalf Of 
Schwartz, Rechell R, ALABS
Sent: Tuesday, July 01, 2003 1:36 PM
To: kjjones(_at_)ntlworld(_dot_)com; 
xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
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



<Prev in Thread] Current Thread [Next in Thread>