Read XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition Online
Authors: Michael Kay
Because a
Step
in a path expression is now a general expression (see Chapter 9), it becomes possible in XPath 2.0 to use parentheses in a path expression such as
book/(chapter|appendix)/title
.
Context Item Expressions
The
ContextItemExp
r
is simply the expression
.
:
Expression | Syntax |
ContextItemExpr | . |
The context item may either be a node or an atomic value, or its value may be undefined. If the value is undefined, then evaluating the expression
.
causes an error.
At the outermost level of an XPath expression, the value of the context item is established by the calling environment. For example, in XSLT it is determined by the innermost
Internally within an XPath expression, there are two constructs that change the context item. Within a predicate
P
of an expression such as
$SEQ[P]
, the predicate is evaluated for each item in
$SEQ
in turn, with that item as the context item, and on the right-hand side of the
/
operator, in a path expression such as
E1/E2
, the context item for evaluating
E2
is set to each item in
E1
in turn.