[Home] [By Thread] [By Date] [Recent Entries]

  • To: xml-dev@l...
  • Subject: XPath brain teaser
  • From: "Roger L. Costello" <costello@m...>
  • Date: Tue, 26 Aug 2003 12:46:11 -0400
  • Organization: The MITRE Corporation

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



Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member