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

RE: Assigning types to variables

Subject: RE: Assigning types to variables
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Wed, 13 Sep 2006 15:58:56 +0100
windows livet messenger
In the absence of an "as" attribute, $test refers to a document node that
has the element <one> as its child. 

With the "as" attribute present, $test refers to the <one> element.

See http://www.w3.org/TR/xslt20/#variable-values

Michael Kay
http://www.saxonica.com/

 

> -----Original Message-----
> From: tom tom [mailto:tomxsllist@xxxxxxxxxxx] 
> Sent: 13 September 2006 15:52
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  Assigning types to variables
> 
> Hi all, if I have declared the following variable:
> 
> <xsl:variable name="test" as="element()">
>         <one>
>             <two>hello</two>
>         </one>
> </xsl:variable>
> 
> I don't understand why <xsl:sequence select="$test/two"/> 
> retrieves the value of <two/> while <xsl:sequence 
> select="$test/one/two"/> does not. If I omit the 'as' 
> attribute it works the other way round. What exactly is 
> happening when I assign a node() or element() or whatever 
> type to this variable?
> 
> Also could you advise what type I should be using for this 
> kind of task?
> 
> I guess my problem is that I'm thinking about variables in 
> XSLT 1 terms!
> 
> As usual thanks in advance
> 
> Tom
> 
> _________________________________________________________________
> Windows LiveT Messenger has arrived. Click here to download 
> it for free! 
> http://imagine-msn.com/messenger/launch80/?locale=en-gb

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.