You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "Brian Minchau (JIRA)" <xa...@xml.apache.org> on 2006/10/17 19:30:38 UTC
[jira] Commented: (XALANJ-2319) Descendant axis sometimes includes
the context node
[ http://issues.apache.org/jira/browse/XALANJ-2319?page=comments#action_12442998 ]
Brian Minchau commented on XALANJ-2319:
---------------------------------------
Per the JIRA triage meeting on Oct 16, 2005, Brian M. agreed to look at this one.
> Descendant axis sometimes includes the context node
> ---------------------------------------------------
>
> Key: XALANJ-2319
> URL: http://issues.apache.org/jira/browse/XALANJ-2319
> Project: XalanJ2
> Issue Type: Bug
> Components: parse-or-compile
> Affects Versions: 2.7
> Reporter: Igor Peshansky
> Assigned To: Brian Minchau
>
> The following code:
> import javax.xml.parsers.DocumentBuilderFactory;
> import javax.xml.xpath.XPath;
> import javax.xml.xpath.XPathConstants;
> import javax.xml.xpath.XPathFactory;
> import org.w3c.dom.DOMImplementation;
> import org.w3c.dom.Document;
> import org.w3c.dom.Element;
> public class Y {
> public static void main(String[] stringArr) throws Exception {
> DOMImplementation domImpl = DocumentBuilderFactory.newInstance().newDocumentBuilder().getDOMImplementation();
> Document document = domImpl.createDocument(null, "foo", null);
> Element element = document.getDocumentElement();
> element.appendChild(document.createElement("bar"));
> XPath xpath = XPathFactory.newInstance().newXPath();
> String result = (String) xpath.evaluate("name(./descendant::*)", element, XPathConstants.STRING);
> System.out.println(result);
> }
> }
> prints "foo", whereas it should have printed "bar". Changing the XPath expression from "name(./descendant::*)" to "name(self::node()/./descendant::*)" makes Xalan produce the correct result, but "name(self::node()/descendant::*)" still exhibits the incorrect behavior.
> A bit of debugging shows that when DescendantIterator is created, the constructor sets the axis to DESCENDANTORSELF, because the first step is a FROM_SELF (even though the subsequent steps are not supposed to return the self node).
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org