xsl-list
[Top] [All Lists]

RE: Alternate row color

2003-01-10 14:34:54
Try this instead...

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
<xsl:output method="html"/>
<xsl:template match="/">
<html>
<STYLE>
TR.clsOdd { background-Color:  #feeded; }
TR.clsEven { background-color: #beefee; }
</STYLE>
<head>
</head>
<body>
<p>
<center>
<table>
<tr>
<th>Client Number</th>
<th>Client Name</th>
<th>Client SSN</th>
<th>Relationship Description</th>
</tr>
<xsl:apply-templates  select="Data"/>
</table>
</center>
</p>
</body>
</html>
</xsl:template>

<xsl:template match="data1">
<tr>
<xsl:choose>
   <xsl:when test="position() mod 2 = 1">
    <xsl:attribute name="class">clsOdd</xsl:attribute> 
   </xsl:when>
   <xsl:otherwise>
    <xsl:attribute name="class">clsEven</xsl:attribute> 
   </xsl:otherwise>
  </xsl:choose>
<td><xsl:value-of select="./info1/clnum"/></td>
<td><xsl:value-of select="./info1/clname"/></td>
<td><xsl:value-of select="./info1/ssn"/></td>
<td><xsl:value-of select="./info1/rel_desc"/></td>
</tr>
</xsl:template>
</xsl:stylesheet>

Hope that helps,
John Pallister

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



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