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

Re: xsl:if @attribute + xsl:variable not working

Subject: Re: xsl:if @attribute + xsl:variable not working
From: Alessio Mazzieri <mazzieri@xxxxxxxxxxx>
Date: Wed, 28 Nov 2001 09:35:01 +0100
xsl if attribute
This is an alternative solution to your problem:

<xsl:for-each select="area">
  <td>
    <xsl:attribute name="bgcolor">
      <xsl:choose>
        <xsl:when test="@position=1">
          #FF7A0
        </xsl:when>
        <xsl:otherwise>
          #FF980F
        </xsl:otherwise>
      </xsl:choose>
    </xsl:attribute>
  </td>
</xsl:for-each>

About the message error, I think that the problem is an "out-of-scope" matter, because both the <xsl:variable> are inside an <xsl:if> element.
Give an eye to Mickeal Kay's XSLT Programmers Reference, page 315: the same example! :)


Aniceto Lopez wrote:

Hi all:
why if

<xsl:for-each select="area">
    <xsl:if test="@position = 1">
      <xsl:variable name="color" select="'#FFF7A0'"/>
    </xsl:if>
    <xsl:if test="@position = 2">
      <xsl:variable name="color" select="'#FF980F"/>
    </xsl:if>

<td bgcolor="{$color}">dadada asda</td>

</xsl:for-each>

I get this?

"A reference to variable or parameter 'colortabla' cannot be resolved.
The variable or parameter may not be defined, or it may not be in scope."

-> the variable IS in scope (if I define it without xsl:if it works)
xml -> <area position="1"> or <area position="2">


thanks in advance


Aniceto Lopez




XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list






XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



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.