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
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:
namespace::*
selects all namespace nodes in scope for the context node. If the context node is not an element or belongs to no namespace, the result sequence is empty.
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.
Copyright © Galileo Press, Bonn 2008
You may print the online version for private use.
Otherwise, this chapter from "XSLT 2.0 & XPath 2.0 ― Das umfassende Handbuch" is subject to the same terms as the bound edition: the work and all its parts are protected by copyright. All rights reserved, including reproduction, translation, microfilming, storage and processing in electronic systems.
Galileo Press, Rheinwerkallee 4, 53227 Bonn