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

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

Syntax

Expression
Syntax
RelativePathExpr
StepExpr ( (
/
|
//
) StepExpr )*
StepExpr
AxisStep
|
FilterExpr

We will come back to the pseudo-operator
//
later in the the chapter; for the moment, we will discuss the meaning of
/
. Moreover, we will confine ourselves for the moment to the case where the expression on the right hand side of
/
selects nodes (we will see in Chapter 10 that the operator can also be overloaded to select atomic values). Understanding this operator is the key to understanding path expressions.

An arithmetic expression such as
A+B+C
can be decomposed into the form
(A+B)+C)
, and defined in terms of a binary
+
operator that takes two operands. Similarly, a path expression of the form
A/B/C
can be decomposed into
(A/B)/C)
, which means that the result of a path expression is defined entirely in terms of the meaning of the binary
/
operator. There is a difference, however: The
/
operator is a higher-order operator, because the expression used as its right-hand operand is evaluated repeatedly, once for every item in the sequence selected by the first operand.

Other books

Brushed by Scandal by Gail Whitiker
Winter in Paradise by T. C. Archer
Retribution by John Fulton
Possession of the Soul by Trinity Blacio
Post Captain by Patrick O'Brian
Zomblog 05: Snoe's War by T. W. Brown
WINDHEALER by Charlotte Boyett-Compo