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

Rabbit Redux by John Updike
Call It Sleep by Henry Roth
Cyclogeography by Jon Day
Sammy Keyes and the Wild Things by Wendelin Van Draanen
Line of Fire by Anderson, Simone
La cabeza de la hidra by Carlos Fuentes
Irresistible by Mackenzie McKade
Stable Witch by Bonnie Bryant
Snow Heart by Knight, Arvalee