The best XPath axes (Axes) Tutorial In 2024, In this tutorial you can learn XML instance documents,XPath axes (Axes),
We will use this XML document in the following example:
Axis can be defined with respect to the set of nodes of the current node.
Axis name | result |
---|---|
ancestor | Select all ancestors of the current node (parent, grandparent, etc.). |
ancestor-or-self | Select all ancestors of the current node (parent, grandparent, etc.) and the current node itself. |
attribute | Select all the attributes of the current node. |
child | Selects all child elements of the current node. |
descendant | Select all descendants of the current node elements (promoter, Sun, etc.). |
descendant-or-self | Select all descendants of the current node elements (promoter, Sun, etc.) and the current node itself. |
following | Select all nodes in the document after the closing tag of the current node. |
namespace | Select all namespaces of the current node. |
parent | Select the parent of the current node. |
preceding | Select all the nodes in the document before the start tag of the current node. |
preceding-sibling | Select all siblings before the current node. |
self | Select the current node. |