[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Setting table row color with xsl:choose and xsl:variab

Subject: Setting table row color with xsl:choose and xsl:variable
From: aevarga@xxxxxx
Date: Mon Oct 31 11:01:41 2005
xslt row color
I would like to set the color of a table row based on the value in one of the data fields.  The long way, which works, is to repeat the entire <tr><td> pattern for each value.  Isn't it possible using some variation of the following code to just read the field's value, assign a CSS class to the row and continue with template matching for the <td>'s?

<xsl:template match="Event">         
<xsl:choose>
  <xsl:when test="Required = 'yes'">
    <xsl:variable name="rowClass">calendarltred</xsl:variable>
  </xsl:when>
  <xsl:when test="Special = 'meeting'">
    <xsl:variable name="rowClass">calendaryellow</xsl:variable>
  </xsl:when>
  <xsl:when test="Special = 'candysale'">
    <xsl:variable name="rowClass">calendarltblue</xsl:variable>
  </xsl:when>
  <xsl:otherwise>
    <xsl:variable name="rowClass">default</xsl:variable>
  </xsl:otherwise>
</xsl:choose>
    <tr class="{$rowClass}">
      <td>
        <xsl:apply-templates select="DayOfWeek" />
        <xsl:apply-templates select="MonthName" />
        <xsl:apply-templates select="DayNum" />
      </td>
...

Thanks, Alan

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.