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.23Mb 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 Cliff House Strangler by Shirley Tallman
A Different Kind of Beauty by Cooper, Alyssa
Ascend by Ophelia Bell
A Sense of Entitlement by Anna Loan-Wilsey
The German Girl by Armando Lucas Correa
Dragonsinger by Anne McCaffrey
Feels Like the First Time by Pendragon, Uther
Mein Kampf - the Official 1939 Edition by Adolf Hitler, James Murphy, Bob Carruthers