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

RE: Re: Re: The Perils of Sudden Type-Safety in XPath

Subject: RE: Re: Re: The Perils of Sudden Type-Safety in XPath 2.0
From: "bryan" <bry@xxxxxxxxxx>
Date: Wed, 26 Feb 2003 13:48:26 +0100
xslt variable name global
>http://www.w3.org/TR/xslt20/#d5e7759

>The WD Spec contains the first of the above examples. The second was
>added by me, because it is perfectly legal now, according to the
>current WD Spec.

from reading the spec I don't think that these 

> ><xsl:variable name="x" select="0"/>


> ><xsl:variable name="x" select="3"/>

> >  <xsl:variable name="x" select="$x + 2"/>

are legal

in that what my impression is that you mean the following would be
legal:

<xsl:template match="/">
<xsl:variable name="x" select="0"/>
<xsl:variable name="x" select="3"/>
<xsl:variable name="x" select="$x + 2"/>


</xsl:template>

it seems to me that is clearly illegal. 

However it seems (from reading the spec) that the following would be
legal:

<xsl:variable name="global" select="'text'"/>
<xsl:template match="/">
<xsl:variable name="global" select="'newtext'"/>
<xsl:variable name="globalnew">
<xsl:variable name="global" select="concat($global,'hi')"/>
<xsl:value-of select="$global"/>
</xsl:variable>
<result><xsl:value-of select="$globalnew"/></result>
</xsl:template>

according to these rules of shadowing variables they have.

I'm not sure if this would be legal (I'd check but I don't have the xslt
2.0 version of saxon on my machine anymore)

<xsl:variable name="global" select="'text'"/>
<p><xsl:variable name="global"
select="concat('new',$global)"/><xsl:value-of select="$global"/></p>

but I'm thinking that this might be?




<xsl:variable name="global" select="'text'"/>
<xsl:element name="p"><xsl:variable name="global"
select="concat('new',$global)"/> )"/><xsl:value-of
select="$global"/></xsl:element>

taking somewhat further the ability in xsl 1.0 I never like of being
able to declare a variable globally and locally. I tend just to name all
my local variables loc{globalVariableName} if there is a relationship.


 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.