minoru.tomisaka.zh | 3 Mar 2006 14:10
Picon

namespace axis interpretation


Intuitively, XPath expression //namespace:foo selects "the namespace nodes
with same namespace URI bound to the prefix foo by the given namespace
context", in corresponding to the interpretation of the element's node test.

For example, considering that the XML document:
<e xmlns="http://foo" xmlns:bar="http://bar" />

given namespace context: { xmlns:foo="http://foo" }
XPath expression: //namespace::foo
select, in my consideration:
nodeset: { xmlns="http://foo" }

given namespace context: { xmlns:bar="http://zoo" }
XPath expression: //namespace::bar
select, in my consideration:
nodeset: {} (empty nodeset)

On the other hand, XPath spec http://www.w3.org/TR/xpath describes:
* In section 2.3, a node test is true if the node has the equivalent
  expanded-name and,
* In section 5.4, a namespace node has an expanded-name: the local part
  is the namespace prefix (this is empty if the namespace node is for the
  default namespace); the namespace URI is always null.

My straightfoward interpretation of the above are:
* The QName of foo in //namespace:foo is foo, its expanded-name is
  {<null>}foo and,
* The QName of xmlns="http://foo" is xmlns, its expanded-name is
  {<null>}<""> and, so that,
(Continue reading)


Gmane