Syntax
- All ancestors of a node
- /path to the node/ancestor::node()
- A specific ancestor of a node
- /path to the node/ancestor::ancestor_name
- Parent of a node
- /path to the node/parent::node()
- Following siblings of a node
- /path to the node/following-sibling::node()
- A specific sibling following a node
- /path to the node/following-sibling::sibling_name
- Preceding siblings of a node
- /path to the node/preceding-sibling::node()
- A specific sibling preceding a node
- /path to the node/preceding-sibling::sibling_name
- All immediate child nodes of a node
- /path to the node/child::node()
- A specific immediate child node of a node
- /path to the node/child::chid_name
- All the descendants of a node
- /path to the node/descendant::node()
- All specific descendants of a node
- /path the to node/descendant::descendant_name
Parameters
Axis | selects |
---|
ancestor | all the ancestor nodes |
parent | parent node |
following-sibling | siblings following the node |
preceding-sibling | siblings preceding the node |
child | immediate children |
descendant | all the descendant irrespective of the nesting level |
These axes can be used in combination with other functions to suit our needs.