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

variable scope and test directives

Subject: variable scope and test directives
From: "Terence Kearns" <tk.lists@xxxxxxxxxxx>
Date: Thu, 20 Feb 2003 19:02:09 +1100
test directives
Is it just my Sablotron processor, or are variables declared inside
xsl:choose trapped inside the "choose" scope(?)?

That seems useless. It means I can't do things like.

<xsl:choose>
    <xsl:when test="/app/presentation/series_id='0'">
        <xsl:variable name="defaultOption">
            <option value="0">&#xa0;</option>
        </xsl:variable>
    </xsl:when>
    <xsl:otherwise>
        <xsl:variable name="defaultOption" select="''" />
    </xsl:otherwise>
</xsl:choose>

because now I can't use $defaultOption anywhere.

This doesn't work either:

<xsl:if  test="/app/presentation/series_id='0'">
    <xsl:variable name="defaultOption">
        <option value="0">&#xa0;</option>
    </xsl:variable>
</xsl:if>
<xsl:if  test="/app/presentation/series_id!='0'">
    <xsl:variable name="defaultOption" select="''" />
</xsl:if>
<xsl:value-of select="$defaultOption" />

How is this just crappy behavior or is there a valid reasons for
considdering a test condition as variable scope boundaries? Surely no
other language does this - because it's, er, stupid!
_____________________________
http://terencekearns.com

 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.