xsl-list
[Top] [All Lists]

greenhorn problem with variables

2005-03-19 04:19:22
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



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>