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

Interpretation of (preceding::foo)[1]

Subject: Interpretation of (preceding::foo)[1]
From: "Paul W. Abrahams" <abrahams@xxxxxxxxxxx>
Date: Wed, 01 Dec 1999 23:49:09 -0500
preceding foo 1
The XPath spec, Sec. 3.3.(Node-sets) contains this note:

The meaning of a Predicate depends crucially on which axis applies.
For example, preceding::foo[1] returns the first foo element in
reverse document order, because the axis that applies to the [1]
predicate is the preceding axis;
by contrast, (preceding::foo)[1] returns the first foo element in
document order, because the axis that applies to the [1] predicate is
the child axis.

The note seems to be ambiguous in that it doesn't say whether the two
specifiers are being considered as expressions or as location paths,
but there are problems of interpretation either way.

If they are considered as expressions, then preceding::foo[1] is a
location path treated as an expression while (preceding::foo)[1] is
directly an expression consisting of the parenthesized expr
(preceding::foo) narrowed by the predicate[1], and the child axis
isn't applied, despite what the note says.

But if they are considered as location paths, then the location path
(preceding::foo)[1] seems to be an abbreviation of the location path
child::(preceding::foo)[1], and the selected nodes, order aside, are
the children of foo nodes rather than the foo nodes themselves.  In
this case the two node-sets to which the [1] predicate is applied are
quite different.

Am I misunderstanding this note or is there really something wrong
with it?

Paul Abrahams



 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.