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

RE: Setting background colour according to contents of

Subject: RE: Setting background colour according to contents of node
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Sun, 19 Sep 2004 09:18:23 +0100
xsl background
Use

<xsl:attribute name="background-color">
  <xsl:apply-templates select="BREAK_3" mode="get-colour"/>
</xsl:attribute>

then

<xsl:template match="* mode="get-colour">
  <xsl:choose>
    <xsl:when test="FIELD_134='Y' or ...>
etc.
</xsl:template>

In other words, but the conditional code in the piece that generates the
attribute that varies, not in the piece that generates its containing
element.

Michael Kay


> -----Original Message-----
> From: Sean & Helen [mailto:scarlson65@xxxxxxx] 
> Sent: 19 September 2004 06:29
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  Setting background colour according to contents of node
> 
> Hi all,
> I was trying to set a background colour by setting a variable 
> after checking
> the contents of a node. I realized that this would not work 
> unless I used
> LOTS of variables since the value of a variable cannot be 
> updated once set.
> Does anyone have an easier way to set a colour based on data? 
> The only other
> way I can think of is to use an <xsl:choose> but then I have 
> to repeat my
> whole table cell code twice (which really adds up for large reports).
> 
> This is what I currently have (which is pretty awful):
> 
> <xsl:choose>
> <xsl:when test="BREAK_3/FIELD_134[1]=Y or BREAK_3/FIELD_135[1]='F'">
>      <fo:table-cell background-color="#9DE1DF"> .... contents 
> of the cell
> .... </fo:table-cell>
> </xsl:when>
> 
> <xsl:otherwise>
>      <fo:table-cell background-color="white">...exactly the 
> same code for
> the contents...</fo:table-cell>
> </xsl:otherwise>
> </xsl:choose>
> 
> TIA for listening to my silly question,
> Helen.

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.