Location steps
A location step has the form
axis :: node-test [ predicate ]
- The axis selects a set of candidate nodes (e.g. the
child nodes of the context node).
- The node-test performs an initial filtration of the
candidates based on their
- types (chardata node, processing instruction, etc.), or
- names (e.g. element name).
- The predicates (zero or more) cause a further, potentially more
complex, filtration.
Only candidates for which the predicates
evaluate to true are kept.
The candidates that survive the filtration constitute the
result.
This structure of location paths and steps makes implementation rather easy.
The example from before:
child::section[position()<6]/descendant::cite/attribute::href
|
selects all href attributes in cite elements in the
first 5 sections of an article.