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

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

I'll cover the
,
operator (which concatenates two sequences), together with the
ForExpr
and the
QuantifiedExpr
in Chapter 10, which is all about expressions on sequences. The
IfExpr
(which allows you to write conditional
if..then..else
expressions) is covered in this chapter, on page 551, and the
OrExpr
, which allows you to use the boolean
or
operator, and provides the entry point to most of the rest of the XPath syntax, is described in Chapter 8.

The
ExprSingle
construct has a special role in the grammar. Because the
,
symbol is overloaded (it's used both as an operator for concatenating two lists and also as a syntactic delimiter in constructs such as a function call), there are places where you might expect the grammar to allow any
Expr
to appear but where, in fact, only an
ExprSingle
is allowed. This means that if you want to use a
,
operator in such contexts, you have to enclose the expression in parentheses.

The constructs
IfExpr
,
ForExpr
, and
QuantifiedExpr
are syntactically unusual in the XPath grammar because they start with keywords and contain multiple subexpressions. In a conventional language, they would probably be called statements rather than expressions. Nevertheless, they are true expressions, in the sense that they can be evaluated to produce a result, and they can appear anywhere in the grammar where an expression is required.

The
OrExpr
starts a list of productions that contains all the conventional expressions of the language, as follows:

Expression
Syntax
OrExpr
AndExpr (
or
AndExpr )*
AndExpr
ComparisonExpr (
and
ComparisonExpr )*
ComparisonExpr
RangeExpr
( (ValueComp | GeneralComp | NodeComp) RangeExpr )?
RangeExpr
AdditiveExpr (
to
AdditiveExpr )?
AdditiveExpr
MultiplicativeExpr ( (
+
|

) MultiplicativeExpr )*
MultiplicativeExpr
UnionExpr
( (
*
|
div
|
idiv
|
mod
) UnionExpr )*
BOOK: XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition
4.36Mb size Format: txt, pdf, ePub
ads

Other books

The Terran Mandate by Michael J Lawrence
The Shadow King by Killough-Walden, Heather
Oklahoma kiss by Unknown
On A Short Leash by Lindsay Ross
The Luck of Brin's Five by Wilder, Cherry;
Hood by Noire
The Fourth Season by Dorothy Johnston
Alice in Wonderland High by Rachel Shane