January 2002
Intermediate to advanced
480 pages
11h 5m
English
This axis type contains all ancestors of the current context node. This includes parent nodes, grandparents, and so on. Therefore, the ancestor axis always contains the root node unless root is the context node.
Example:
ancestor::chapter/intro
Like the ancestor axis, this axis selects all ancestors of the context node, including parent nodes, grandparents, and so on. In addition, ancestor-or-self contains the context node itself.
Example:
ancestor-or-self::node()
When the context node is an element node, the attribute axis contains the attributes of this node. For all other node types, the axis is empty.
Example:
attribute::href
Selects children of the context node.
Example: ...