[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] font color


Subject: Re: [xsl] font color
From: "Joris Gillis" <roac@xxxxxxxxxx>
Date: Sat, 30 Jul 2005 10:51:04 +0200

Hi,
Tempore 07:06:45, die 07/30/2005 AD, hinc in xsl-list@xxxxxxxxxxxxxxxxxxxxxx scripsit <jeb501@xxxxxxxxxxxxxxx>:

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
.......
It's best to use CSS for that:

<?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>
<head>
<style type="text/css">
.Y {color:yellow}
.R {color:red}
.B {color:blue}
</style>
</head>
<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 class="{date1/@ctag}">
<xsl:value-of select="date1" />
<xsl:value-of select="date1/@ctag" />
</td>
<td class="{date2/@ctag}">
<xsl:value-of select="date2" />
<xsl:value-of select="date2/@ctag" />
</td>
<td class="{date3/@ctag}">
<xsl:value-of select="date3" />
<xsl:value-of select="date3/@ctag" />
</td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>

</xsl:stylesheet>


regards, -- Joris Gillis (http://users.telenet.be/root-jg/me.html) Vincit omnia simplicitas Keep it simple


Current Thread
  • [xsl] font color
    • jeb501 - Sat, 30 Jul 2005 10:36:45 +0530
      • Joris Gillis - Sat, 30 Jul 2005 10:51:04 +0200 <=
        • jeb501 - Sun, 31 Jul 2005 16:12:29 +0530