[XSL-LIST Mailing List Archive Home]
[Reply To This Message]
Re: Basic question about Namespace handling in XPath 1
Subject: Re: Basic question about Namespace handling in XPath 1.0 (not necessarily related to XSLT)|
From: Prakash <prakash.subramaniam@xxxxxxxxxx>
Date: Wed, 28 Sep 2005 21:06:03 +0530
Thanks everybody for your informative reply on this thread.
Michael Kay wrote:
See the method setNamespaceContext() method on the interface
From: Prakash [mailto:prakash.subramaniam@xxxxxxxxxx]
Sent: 28 September 2005 15:12
Subject: Re: Basic question about Namespace handling in
XPath 1.0 (not necessarily related to XSLT)
My question is not in relation to XSLT. I was talking about the
namespace prefix resolution in general for XPath. For
example, in Java,
JAXP 1.3 has some APIs to process XPath given a context (
Level 3 has some APIs). These APIs are application
independent. I guess,
the namespace mappings available in scope to the context node will be
the deciding factor, right?. Pls, correct me if I am wrong.
Geert Josten wrote:
The answer should be pretty clear, it all depends on how
the namespaces in your XSL stylesheet... :)XPath processor
1. If we have a XPath like "//sup:name", how will the
know which "sup:name" will have to be returned? (considering that
there are two sup:name elements that are in two different
/> will result in the first one.namespace
xmlns:sup="http://www.anothersuppliers.com" /> will result in the
You will probably choose to assing prefix sup1 to the first
and sup2 to the second. If you want both, you can then
//sup1:name|//sup2:name (or //*:name in XSLT 2.0 altogether)elements both
2. Similarly, if we have a XPath such as "//order", which "order"
will be considered considering that there are two order
declared in the
in default namespace (first order element is actually in null
namespace whereas the second one in default namespace
root element)Likewise. I expect that //order results in the first when you don't
specify a default namespace, and in the second if you use
It is adviced not to use default namespaces in XSL
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format