W3C home > Mailing lists > Public > www-xpath-comments@w3.org > April to June 2004

[p1][p2] vs. [p1 and p2]

From: Richard Haven <richard@bradfordsoftware.com>
Date: Tue, 8 Jun 2004 11:38:39 -0700
Message-ID: <DC527A08943BB7479401D8B79035E2FE42965A@linus.atbx.net>
To: <www-xpath-comments@w3.org>

I think that //e[p1][3] describes the third of the list of "e" elements in the document that satisfy [p1]; is this correct?
In other words: 		//e[p1][p2] != //e[p2][p1]

The W3 specification (http://www.w3.org/TR/1999/REC-xpath-19991116) is VERY ambiguous about this point: in 2.5 Abbreviated Syntax, it gives these examples:
	para[@type="warning"][5] selects the fifth para child of the context node that has a type attribute with value warning 
	para[5][@type="warning"] selects the fifth para child of the context node if that child has a type attribute with value warning 

However in 2 Location Paths, it gives these examples:
	child::para[attribute::type='warning'][position()=5] selects the fifth para child of the context node that [child] has a type attribute with value warning 
	child::para[position()=5][attribute::type="warning"] selects the fifth para child of the context node if that child has a type attribute with value warning 

Given the typo in this latter pair of examples, I prefer the first pair. 
Thank you for your attention
Received on Tuesday, 8 June 2004 14:39:23 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:02:15 UTC