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

Owning Corey by Maris Black
Boots for the Gentleman by Augusta Li & Eon de Beaumont
Wings by Danielle Steel
Bachelor Unforgiving by Brenda Jackson
Ice by V. C. Andrews