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=9575>. 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=9575 count() returns wrong value Summary: count() returns wrong value Product: XalanJ2 Version: CurrentCVS Platform: Other OS/Version: Other Status: NEW Severity: Critical Priority: Other Component: org.apache.xpath AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] Given the code below, I create an attribute in an element and evaluate the XPath "count(ancestor-or-self::node())" on that attribute. The ancestor-or-self axis should contain three nodes: The Attribute itself, it's owner element (which is also the document element) and the document node. But instead of 3.0, the evaluate call returns 4.0. Regards, Christian -------------------- DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setNamespaceAware(true); DocumentBuilder db = dbf.newDocumentBuilder(); Document doc = db.newDocument(); Element root = doc.createElement("root"); doc.appendChild(root); Attr attr = doc.createAttribute("attr"); attr.setValue("val"); root.setAttributeNode(attr); CachedXPathAPI xpathAPI = new CachedXPathAPI(); XObject includeInResult = xpathAPI.eval(attr, "count(ancestor-or-self::node())"); double val = includeInResult.num(); System.out.println("count(ancestor-of-self::node()) evaluates to " + val);
