[xsl] font color

Subject: [xsl] font color
From: jeb501@xxxxxxxxxxxxxxx
Date: Sat, 30 Jul 2005 10:36:45 +0530
Hi all,

Please find below the xml and xsl files, where i need to get the node 
contents of date1,date2 and

date3's font color should appear in the output as specified in the ctag 

ie if ctag="Y" , the font color of date1 in the output is yellow and

similerly if ctag="R", the font color of date3 in the output is red 
.......

TIA

Eugene


** xml file **

<?xml version="1.0" ?> 
- <pitems>
- <record>
  <tag1>2</tag1> 
  <tag>Y</tag> 
  <date>29-07-2005</date> 
  <code>aaa</code> 
  <desc>long Pipe</desc> 
  <mqty>1.000</mqty> 
  <qty>2.000</qty> 
  <date1 ctag="Y">19-07-2005</date1> 
  <date2 ctag="B">19-06-2005</date2> 
  <date3 ctag="R">19-05-2005</date3> 
  </record>
  </pitems>



** xsl file **

  <?xml version="1.0" encoding="ISO-8859-1" ?> 
- <xsl:stylesheet version="1.0" xmlns:xsl="
http://www.w3.org/1999/XSL/Transform";>
- <xsl:template match="/">
- <html>
- <body>
  <h4>Report 1</h4> 
- <table border="1" cellpadding="4" cellspacing="0">
- <tr bgcolor="#9acd32">
  <th>Tag</th> 
  <th>Date</th> 
  <th>Hno</th> 
  <th>Description</th> 
  <th>Weight </th> 
  <th>Qty </th> 
  <th>Rp1 Date</th> 
  <th>Rp2 Date</th> 
  <th>Rp3 Date</th> 
  </tr>
- <xsl:for-each select="pitems/record">
- <tr>
- <xsl:if test="tag1 = 1">
  <xsl:attribute name="bgcolor">#ddaadd</xsl:attribute> 
  </xsl:if>
- <xsl:if test="tag1 = 2">
  <xsl:attribute name="bgcolor">#ffdd00</xsl:attribute> 
  </xsl:if>
- <td>
  <xsl:value-of select="tag" /> 
  </td>
- <td>
  <xsl:value-of select="date" /> 
  </td>
- <td>
  <xsl:value-of select="hno" /> 
  </td>
- <td>
  <xsl:value-of select="desc" /> 
  </td>
- <td align="right">
  <xsl:value-of select="mqty" /> 
  </td>
- <td align="right">
  <xsl:value-of select="qty" /> 
  </td>
- <td>
  <xsl:value-of select="date1" /> 
  <xsl:value-of select="date1/@ctag" /> 
  </td>
- <td>
  <xsl:value-of select="date2" /> 
  <xsl:value-of select="date2/@ctag" /> 
  </td>
- <td>
  <xsl:value-of select="date3" /> 
  <xsl:value-of select="date3/@ctag" /> 
  </td>
  </tr>
  </xsl:for-each>
  </table>
  </body>
  </html>
  </xsl:template>
  </xsl:stylesheet>

Current Thread