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

Re: the nearest ancestor with the attribute

Subject: Re: the nearest ancestor with the attribute
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Thu, 18 Jan 2001 13:07:28 +0000
xslt axes select nearest ancestor
Since I started this confusion in the first place, can I summarise and
check that I've got it right now?

A node set is always unordered until you do anything with it like
iterate over it, get a value from it or whatever. Of course a node set
is pretty useless unless you do something with it, so saying a node
set is unordered doesn't particularly help :)

When you use a node set to do something with nodes within an XSLT
attribute (e.g. xsl:value-of/@select or xsl:apply-templates/@select or
xsl:for-each/@select) then the node set is always sorted into
*document order* no matter what axes you use.

When you use a predicate on a node set that's already been generated,
such as a node-set variable, a union or just by putting brackets
around it (e.g. $foo[1], (//*/@*)[1] or (foo|bar)[1]) then the node
set is always sorted into *document order* no matter what axes you
use.

When you use a predicate on a node set within a step (e.g. //*/@*[1]
or foo[1]) then the node set is sorted according to the axis. If it's
preceding::, preceding-sibling::, ancestor:: or ancestor-or-self::
then it's a reverse axis, otherwise it's a forward axis. If it's a
reverse axis, then it's sorted into *reverse document order* before
the predicate is assessed; if it's a forward axis, then it's sorted
into *document order* before the predicate is assessed.

Having said all that, the attribute:: axis and the namespace:: axis
are a bit weird because there is no real concept of 'document
order' for attributes or namespace nodes. So, although @*[1] gives you
the first attribute in document order, this could actually be any
attribute on the element. It rarely makes sense to use a positional
predicate with an attribute or namespace axis because attributes and
namespaces have no inherent position in an element. For attributes
and namespaces, document order is implementation dependent: it's
fairly likely (?) that they'll just be sorted alphabetically.
Namespace nodes always come before attribute nodes, though, and both
occur before any child nodes.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.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.