DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=23933>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=23933 XPath with predicate [1] returns multiple nodes ------- Additional Comments From [EMAIL PROTECTED] 2003-10-21 11:08 ------- David, Thanks for the speedy reply. I know that the xpath used was a little obtuse :-), but I have still some reservations as to what exactly is the correct mode of operation for such expressions. If I were to supply the following XML file <?xml version="1.0" encoding="UTF-8"?> <Envelope> <Security> <Assertion>1.1</Assertion> <Assertion>1.2</Assertion> </Security> <Security> <Assertion>2.1</Assertion> <Assertion>2.2</Assertion> </Security> <Security> <Assertion>3.1</Assertion> <Assertion>3.2</Assertion> </Security> </Envelope> and run the following XPaths (//descendant-or-self::Assertion[parent::Security])[1] (a) //descendant-or-self::Assertion[parent::Security] (b) //descendant-or-self::Assertion[parent::Security][1] (c) //descendant-or-self::Assertion[parent::Security][2] (d) //descendant-or-self::Assertion[parent::Security][3] (e) The following nodes are returned. (I have attached test.xml and test.xsl with output xalan.xml) 1.1 (a) 1.1 1.2 2.1 2.2 3.1 3.2 (b) 1.1 1.2 2.1 2.2 3.1 3.2 (c) 1.2 2.2 3.2 (d) 2.1 (e) It would appear that the operation of the (d) [2] (e) and [3] predicates work differently. (d) appears to select the second Assertion child nodes of selected Security Elements whereas (e) selects the third node outputted from a (b) type expression. Is this not inconsistant behaviour? As a note this is at odds with the XPath Explorer supplied by Purple Technologies (http://www.purpletech.com/index.jsp) which uses an xpath implementation supplied by jaxen.org. XPaths (c) (d) and (e) return Assertion nodes 1.1, 1.2 and 2.1 respectively. This would *seem* more realistic as a filter to the output to the (b) result above. Tony
