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=4835>.
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=4835

XPath execution with a DOM Attr node as context node fails

           Summary: XPath execution with a DOM Attr node as context node
                    fails
           Product: XalanJ2
           Version: 2.2.x
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: org.apache.xpath
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


I am facing problems making XPath queries, when I use a DOM Attr node as the 
context node for the XPath query: In such cases I always get an empty set as
the result of the XPath query, regardless of the XPath expression I use.

To retrace this strange behaviour, please try the following:

  * Use the sample class "ApplyXPath" shipped with Xalan 2.2.D10.

  * Use this as the sample XML input file:
    "<DocRoot attribute="value"/>

  * Use this as the sample XPath expression:
    "/child::*"

Executing this class will print the following output:
"
<output>
<DocRoot attribute="value"/>
 </output>
"

Fine!

But if I change line 128 in file "ApplyXPath.java" from
  "NodeIterator nl = XPathAPI.selectNodeIterator(doc, xpath);"
into
  "NodeIterator nl = XPathAPI.selectNodeIterator(
     doc.getDocumentElement().getAttributes().item(0), xpath);"
to reflect the fact that I would like an attribute node as the 
context node, execution will now print:
"
<output>
 </output>
"
I think this is incorrect, since the XPath expression "/child::*"
does not depend on the context node.

Regards, Gregor

Reply via email to