An axis is used in a location path to specify the tree relationship between the nodes selected by the location step and the context node.
| Axes | Description |
|---|---|
| ancestor | Contains the ancestors of the context node; the ancestors of the context node consist of the parent of the context node and the parent's parent and so on; thus the ancestor axis will always include the root node unless the context node is the root node. |
| ancestor-or-self | Contains the context node and the ancestors of the context node; thus the ancestor axis will always include the root node. |
| attribute | Contains the attributes of the context node; the axis will be empty unless the context node is an element. |
| child | Contains the children of the context node. |
| descendant | Contains the descendants of the context node; a descendant is a child or a child of a child and so on; thus the descendant axis never contains attribute or namespace nodes. |
| descendant-or-self | Contains the context node and the descendants of the context node. |
| parent | Contains the parent of the context node, if there is one. |
| self | Contains just the context node itself. |