slide 47

How a Single Sequence for Works

The syntax

for $variable in sequence return expression 

An example

for $n in child::name return concat($n/fname, ' ', $n/surname)

Warning: the context for the return is the same as the context for the whole for,
so the following will not work

BAD: sum(for $i in order-item return @price * @qty) :BAD