XPath TutorialLesson 49Free preview
XPath Axes
This lesson is part of XML · All levels
Summary
XPath axes define the relationship between the context node and the node being searched for, for example ancestor, descendant, following-sibling, and preceding. Each axis is written with a colon like descendant::book or ancestor-or-self::*. With axes, complex relationship-based selection can be expressed without manual searching.
Key points
- Axes determine the direction of the search relative to the context node
- Ancestor searches for all the parent over the context node
- Descendant looking for all descendants under the node
- Following-sibling and preceding choose brothers aligned
- The shaft can be combined with the predicate for filtering
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.