XML technologies / XPath / XPath 2.0: language reference / Path expressions: axes / Namespace axis

(Excerpt from "XSLT 2.0 & XPath 2.0" by Frank Bongers, chapter 4.)

Defined for: XPath 1.0 (restricted support in XPath 2.0; absent from XQuery 1.0)

Direction: forward

Axis identifier: namespace

Abbreviated syntax: none

The namespace axis, normally omitted from tree diagrams

Figure: the namespace axis, normally omitted from tree diagrams.

The namespace axis contains only namespace nodes in scope for the context node. These namespaces are declared on that node or its ancestors through the pseudo-attribute xmlns:. Namespaces shadowed by a declaration using the same prefix are excluded; the most recently declared namespace is returned.

If the context node has no valid namespace, the axis is empty, as is the case for all node kinds except elements. The namespace axis is one of the forward axes.

Example:

Alternatives to the namespace axis in XPath 2.0:
The namespace axis is deprecated in XPath 2.0 (deprecated), but applications may continue supporting it for XPath 1.0 compatibility, without being required to do so. For reliability, XPath 2.0 expressions should instead use the functions fn:in-scope-prefixes and fn:namespace-uri-for-prefix to obtain the required information.

   

back to top