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

RE: Question about variable definition and types

Subject: RE: Question about variable definition and types
From: "Xia Li" <xli@xxxxxxxxxxxxx>
Date: Thu, 6 Mar 2008 14:29:00 -0800
RE:  Question about variable definition and types
Hi,
   The presence of the attribute "as" determines whether the value of
the variable is evaluated to a sequence or a temporary tree. In this
case, with the "as" attribute, the value of the variable is a sequence
of the element <itSystem>. Without the "as" attribute, the value of the
variable is a document node of a temporary tree, the sequence of
<itSystem> are the children of the document node of the temporary tree.
That's why you have to use the child axis to locate the <itSystem>
elements.

   Lisa


-----Original Message-----
From: Jim Garrison [mailto:Jim.Garrison@xxxxxxxxx]
Sent: Thursday, March 06, 2008 2:01 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject:  Question about variable definition and types

Given

    <xsl:variable name="itSystems" as="element()*">
        <xsl:for-each select="//system">
            <itSystem name="{nameOfSystem}"/>
        </xsl:for-each>
        <xsl:for-each select="//replacedLegacySystem">
            <itSystem name="{nameOfLegacySystem}"/>
        </xsl:for-each>
    </xsl:variable>

The type of $itSystems is such that the following Xpath expression
works:

	$itSystems[@name='whatever...']

However if I remove the as="element()*" attribute then the expression
has to be written as:

	$itSystems/itSystem[@name='whatever...']

What is the formal type of object returned in each case?  In the first I
believe it is a sequence of element nodes, but in the second there seems
to be an additional level of hierarchy.



IMPORTANT NOTICE:
This message may contain confidential information. If you have received
this e-mail in error, do not use, copy or distribute it. Do not open any
attachments. Delete it immediately from your system and notify the
sender promptly by e-mail that you have done so. Thank you.

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.