[xquery-talk] position() and atomic values
Pierrick Brihaye
pierrick.brihaye at free.fr
Wed Jul 6 00:10:44 PDT 2005
Hi,
Given the following XQuery :
let $myStrings := ("string1", "string2", "string3")
return
for $string in $myStrings
return
<string position="{$string/position()}">{$string}</string>
Saxon returns :
Error on line 5 of file:/C:/.../saxonb8-4/in.txt:
XPTY0019: Required item type of first operand of '/' is node(); supplied
value has item type xs:string
Failed to compile query
Quoted from http://www.w3.org/TR/xquery/ :
> [Definition: The context position is the position of the context item within the sequence of items currently being processed.] It changes whenever the context item changes. Its value is always an integer greater than zero. The context position is returned by the expression fn:position(). When an expression E1/E2 or E1[E2] is evaluated, the context position in the inner focus for an evaluation of E2 is the position of the context item in the sequence obtained by evaluating E1. The position of the first item in a sequence is always 1 (one). The context position is always less than or equal to the context size.
and :
> [Definition: The context item is the item currently being processed. An item is either an atomic value or a node.]
My understanding is that position() may concern nodes as well as atomic
values. Am I wrong ?
Cheers,
p.b.
More information about the talk
mailing list