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

RE: [p1][p2] vs. [p1 and p2]

From: Michael Kay <mhk@mhk.me.uk>
Date: Tue, 8 Jun 2004 20:34:09 +0100
To: "'Richard Haven'" <richard@bradfordsoftware.com>, <www-xpath-comments@w3.org>
Message-Id: <20040608194231.41758A2427@frink.w3.org>

I see no ambiguity, I see no typo. What exactly is your problem with the
text in the specification? It gives two examples p[b][n] and p[n][b] and
explains that they have different meanings: exactly the same point that you
start out with.

Are you suggesting that the [child] you have put in square brackets is a
typo? I don't see that word in the original text.

You have muddied the waters by using  //e[p1][3] as your example. //p[3]
does not select the third p element in the document, it selects every p
element that is the third p child of its parent. None of the examples that
you cite from the spec uses "//", so they do not have this problem.

Michael Kay

> -----Original Message-----
> From: www-xpath-comments-request@w3.org 
> [mailto:www-xpath-comments-request@w3.org] On Behalf Of Richard Haven
> Sent: 08 June 2004 18:39
> To: www-xpath-comments@w3.org
> Subject: [p1][p2] vs. [p1 and p2]
> 
> 
> 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 15:42:57 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 5 February 2014 07:15:18 UTC