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

Hot Intent (Hqn) by Dees, Cindy
Time to Love Again by Speer, Flora
Horror: The 100 Best Books by Jones, Stephen, Newman, Kim
Double-Crossed by Barbra Novac
Good Hope Road: A Novel by Sarita Mandanna
The Newgate Jig by Ann Featherstone
Missing Without A Trace by Rider, Tanya
To Honour the Dead by John Dean