Select nodes on the relative path.
A RelativePathExpr
is a path expression consisting of a step
expression that can be followed by one or more steps with or without axis.
Starting from the context node, /
separates location steps, while
//
is the abbreviated syntax for
/descendant-or-self::node()/
. If followed by an
AxisStep
, you can specify an abbreviated or unabbreviated step.
Otherwise, you can specify a node test plus optional predicate expression.
Select all books written by Stevens:
input()//book[author/last = "Stevens"]
The relative path in the bracketed filter expression starts at the
context node book
and selects the
author
child node (a StepExpr
), and
then its child node last
(a
NoAxisStep
).
Select all patients who have been treated with therapies including medication in the form of tablets:
input()/patient[therapy//@form = "tablet"]
The relative path in this expression starts at with
therapy
child nodes of
patient
elements and selects all descendant
attribute nodes with the name form
and value
"tablet" (an abbreviated AxisStep
).
The following construct(s) refer to this construct: