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

Multiple default namespaces cannot be selected with "".





------- Additional Comments From [EMAIL PROTECTED]  2002-02-20 20:49 -------
XPath was _not_ designed as a stand-alone query language, but rather as a 
language which is embedded _within_ other languages.  Those languages are 
required to provide things like variable and namespace bindings.

That said, there is a solution if you're using Xalan's XPathAPI.  If you read 
the documentation, you'll discover that you can implement a PrefixResolver to 
bind namespace URIs to prefixes.  Or, you can provide a Node from the document 
to do the resolution.  One easy way to implement a PrefixResolver would be to 
have it select all of the namespace nodes from the document instance using the 
XPath "namespace::*".  This has problems if one prefix is mapped to multiple 
namespaces in the document, or if there are multiple default namespaces (but 
that's more an issue with the use of default namespaces).

XPath 1.0 consciously excluded node tests of the form "*:foo", where the 
namespace URI is a wild-card. The feature/bug is present in the current XPath 
2.0 working draft, but there's a lot of debate as to whether or not this is 
desirable.

Another solution is to use a predicate which tests for the node names you're 
looking for.  For example:

"//*[local-name() = $nodeName]"

where you've bound the appropriate local name to the variable.  One drawback to 
this approach is that performance is going to be worse.  Another is that you'll 
need to write some custom code, as I believe Xalan-J's XPathAPI does not 
provide a way to bind variables.

If you're interested in discussing this approach or other approaches to using 
XPath, I suggest you post a message on the Xalan-J user list.

Reply via email to