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
9Mb 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

Tears of Kerberos by Michael G Thomas
The Explorer by James Smythe
Exit Laughing by Victoria Zackheim
Hearts Under Fire by Kelly Wyre and HJ Raine
1609366867 by Janice Thompson
Untrained Fascination by Viola Grace
Dead Spots by Melissa F. Olson
Deep Focus by McCarthy, Erin