SAXONICA |
The expression E1 to E2
returns a sequence of integers. For example, 1 to 5
returns the sequence 1, 2, 3, 4, 5
. This is useful in for
expressions, for example
the first five nodes of a node sequence can be processed by writing for $i in 1 to 5 return (//x)[$i]
.
If you prefer, you can write this as (//x)[position() = 1 to 5]
. This works because
comparison of a single integer (position()
) to a sequence of integers (1 to 5
)
is true if the integer on the left is equal to any integer in the sequence.