Xpath Axes
# XPath Axes
* * *
## XML Sample Document
We will use the following XML document in the examples below:
```xml
Harry Potter
29.99
Learning XML
39.95
* * *
## XPath Axes
Axes define a node set relative to the current node.
| Axis Name | Result |
| --- | --- |
| ancestor | Selects all ancestors (parent, grandparent, etc.) of the current node. |
| ancestor-or-self | Selects all ancestors (parent, grandparent, etc.) of the current node, as well as the current node itself. |
| attribute | Selects all attributes of the current node. |
| child | Selects all child elements of the current node. |
| descendant | Selects all descendants (children, grandchildren, etc.) of the current node. |
| descendant-or-self | Selects all descendants (children, grandchildren, etc.) of the current node, as well as the current node itself. |
| following | Selects all nodes in the document that come after the end tag of the current node. |
| following-sibling | Selects all sibling nodes that follow the current node. |
| namespace | Selects all namespace nodes of the current node. |
| parent | Selects the parent node of the current node. |
| preceding | Selects all nodes in the document that come before the start tag of the current node. |
| preceding-sibling | Selects all sibling nodes that precede the current node. |
| self | Selects the current node. |
AI is thinking...
[](#)(#)
(#)[](#)
[Byte Ark Coding Plan supports mainstream large models such as Doubao, GLM, DeepSeek, Kimi, MiniMax, etc., with official direct supply for stability and reliability. Β₯9.9/month Activate Now](https://maas.xfyun.cn/modelSquare?ch=maas_lm_l2E)
YouTip