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

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

We'll look first at
for
expressions that operate on a single sequence and then move on to the more general case where there are multiple input sequences.

Mapping a Sequence

When used with a single sequence, the
for
expression applies the expression in the
return
clause to each item in the input sequence. The relevant item in the input sequence is accessed not as the context item but as the value of the variable declared in the
for
clause.

These variables are referred to as range variables, to distinguish them from variables supplied from outside the XPath expression, such as variables declared in an XSLT stylesheet. The term comes originally from the branch of mathematical logic called predicate calculus.

In most cases the expression in the
return
clause will depend in some way on the range variable. In other words, the
return
value is a function of the range variable, which means we can rewrite the
for
expression in the abstract form:

Other books

Dove's Way by Linda Francis Lee
Wild Angel by Miriam Minger
Double Play by Jill Shalvis
A Small Town in Germany by John le Carre
Outriders by Jay Posey
Harrison Squared by Daryl Gregory
Stuck in Neutral by Terry Trueman
Daniel's Bride by Hill, Joanne