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

The Whole Day Through by Patrick Gale
Warrior by Jennifer Fallon
The Searchers by LeMay, Alan
Exile by Anne Osterlund
Dangerous Games by Keri Arthur
Deborah Goes to Dover by Beaton, M.C.
The Misfit Marquess by Teresa DesJardien