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

greenhorn problem with variables

Subject: greenhorn problem with variables
From: Volker Katz <Volker.Katz@xxxxxx>
Date: Sat, 19 Mar 2005 12:19:22 +0100
volker katz
Hi,
I've got a quite simple problem. I've tested a lot, but didn't get the 
solution.So I hope you give me a hint.

In a template I calculate a bgcolor depending on position:
<xsl:template match="eintrag">
  <xsl:variable name="color"> 
    <xsl:choose>
      <xsl:when test="(position() mod 2) &gt; 0">#C0C0C0</xsl:when>  
      <xsl:otherwise>#FFFFFF</xsl:otherwise>
    </xsl:choose>
  </xsl:variable> 
  <tr>
     <xsl:apply-templates select="nr"/> 
     <xsl:apply-templates select="km"/>
   <!-- ... -->
  </tr>
</xsl:template>

I need to use the variable in the applied templates. Here is an example:
<xsl:template match="nr">
  <td bgcolor="{$color}"> 
    <xsl:value-of select="."/>
  </td>
</xsl:template>

How can I solve this? I can't calculate the color global... Can I solve 
this with params instead of varialbes? I tried but didn't get it.

Best regards
  Volker

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.