You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by bu...@apache.org on 2004/02/10 15:30:58 UTC
DO NOT REPLY [Bug 26823] -
XPath ignores namespace declarations except on root element
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=26823>.
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=26823
XPath ignores namespace declarations except on root element
------- Additional Comments From keshlam@us.ibm.com 2004-02-10 14:30 -------
I believe this is working as designed.
The problem isn't the namespaces in your source document -- it's the namespaces
in your XPath.
The document is fine. But the XPathAPI defaults to picking up understanding of
how namespace prefixes are bound *only* from the namespaces actually declared
on the namespace context node; it does not search the subtree for them (which
would be slow, could have conflicts, etc.)
Either provide (construct?) a namespace context node which does declare all the
prefixes your XPath needs, or plug in a prefix resolver to provide those
bindings. See the alternative forms of XPathAPI invocation at
http://xml.apache.org/xalan-j/apidocs/org/apache/xpath/XPathAPI.html
(Yes, it would be nice if XPath had a version which included prefix bindings in
the path syntax, or which used actual namespace URIs rather than prefixes, so
you could write truly portable self-contained XPaths. I've been grumbling about
that for a very long time...)