XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition (304 page)

BOOK: XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition
4.86Mb size Format: txt, pdf, ePub

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

or

iteration. Where XPath expressions are evaluated from a host language such as Java or C#, the calling API often provides the application with a way to set the initial context item.

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.

Other books

Cassandra Austin by Callyand the Sheriff
Sirens by Janet Fox
Blind Spot by B. A. Shapiro
Abandoned by Anya Peters
Sleight Of Hand by Kate Kelly
The Art of Jewish Cooking by Jennie Grossinger
The Crisscross Shadow by Franklin W. Dixon
The Right Thing by Judy Astley