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

Ransom by Jon Cleary
Kafka en la orilla by Haruki Murakami
Blindfolded by Breanna Hayse
Face Value by Cheryl Douglas
The Secrets of Silk by Allison Hobbs
Traces by Betty Bolte
Tycoon Takedown by Ruth Cardello