XML technologies / XPath / XPath 2.0: language reference / Path expressions: axes / Attribute axis
(Excerpt from "XSLT 2.0 & XPath 2.0" by Frank Bongers, chapter 4.)
Defined for: XPath 1.0 and 2.0, XQuery 1.0
Direction: forward
Axis identifier: attribute
Abbreviated syntax: @
Figure: the attribute axis, normally omitted from tree diagrams.
The attribute axis is one of the forward axes. It contains all attributes of the context node if that node is an element. Attributes have no fixed order on the axis, so a result sequence has an arbitrary order (arbitrary order).
If the context node is not an element, the axis is always empty. This also applies to the document node, which cannot have attributes.
The frequently used attribute axis has “@” as abbreviated syntax.
Example:
attribute::*
selects all attributes of the context node, regardless of name. If it is not an element or is an element without attributes, the result sequence is empty.
@*
The abbreviated expression has the same result asattribute::*and produces the same sequence.
attribute::mein_attribut
selects all attributes of the context node namedmein_attribut. Since each attribute can occur at most once per element, the result contains at most one node.
@mein_attribut
Abbreviated syntax for the preceding expression.
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