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

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

for $x in $SEQ return F($x)

where
F($x)
represents any expression that depends on
$x
(it doesn't have to depend on
$x
, but it usually will).

What this does is to evaluate the expression
F($x)
once for each item in the input sequence
$SEQ
and then to concatenate the results, respecting the original order of the items in
$SEQ
.

In the simplest case, the return expression
F($x)
returns one item each time it is called. This is illustrated in
Figure 10-1
, where the function
F($x)
in this example is actually the expression
string-length($x)
.

We say that the expression
for $x in $SEQ return string-length($x)
maps
the sequence
“red”,“blue”,“green”
to the sequence
3,4,5
.

Other books

The Sin of Cynara by Violet Winspear
Mathieu (White Flame Trilogy) by Paula Flumerfelt
Burn by Aubrey Irons
The Deception of Love by Kimberly, Kellz
The Secrets We Keep by Stephanie Butland
The Ties That Bind by Jaci Burton
The Sun Down Motel by Simone St. James