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: @

The attribute axis, normally omitted from tree diagrams

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:

   

back to top