← Prev in month ← Prev in thread

XPath brain teaser

From
Roger L. Costello <>
To
Date
2003-08-26T16:46:11Z
ID
<>
Thread
XPath brain teaser
These two XPath expressions are equivalent:

     //para[1]
     /descendant::para[1]

(a) True
(b) False

Scroll down to see answer.







































Answer: (b) False
Here's what the XPath 2.0 spec says:

"Note that the path expression //para[1] does not mean the same as the
path expression /descendant::para[1]. The latter selects the first
descendant para element; the former selects all descendant para elements
that are the first para children of their parents."

Am I the only one who answered this: (a) True?
This doesn't seem intuitive to me. Comments?  /Roger
← Prev in month ← Prev in thread