* matches element nodes, node() matches any node, including the document node. Please note that the document node is not the same as the document element node. The element named "root" is your document element, but the document node is referenced by "/". When you say that query 2 returns the document "root", please note that you have confusingly named your document element "root". The document node (or root node as it is often called) is a top-level node that does not represent any actual content of the XML, but is really there as the "top" of the tree. It is the immediate parent of everything that is not inside of the document element. By naming your document element "root" I suspect you've confused yourself.
-----Original Message----- From: Travis Stevens [mailto:[EMAIL PROTECTED] Sent: Thursday, December 23, 2004 12:35 PM To: [EMAIL PROTECTED] Subject: xpath queries I think that these two queries should return the same results: 1. /root/title[text() = 'A Test Record']/parent::root/parent::* 2. /root/title[text() = 'A Test Record']/parent::root/parent::node() on the xml: <root> <title>A Test Record</title> </root> Query 2 returns the document root and query 1 returns nothing when executing this query with xalan 2.5.1. The method I used is org.apache.xpath.XPathAPI.selectNodeList(Node,String). thanks, -Trav
