[xquery-talk] Re: position() and atomic values
Peter.Coppens at datadirect.com
Wed Jul 6 06:46:01 PDT 2005
> Now, what about the following error :
> XPDY0002: The context position is currently undefined
> Query processing failed: Run-time errors were reported
> returned by :
> let $myStrings := ("string1", "string2", "string3")
> for $string in $myStrings
> order by position()
> return $string
> Well, this example is a bit silly but I try to find examples
> where position() is
> not used in a predicate.
When you want to use position() the context item has to be defined in
Besides an implementation defined mechanism to set the "initial context
item" (I think Saxon does support some way of doing that) you can
achieve this through path or filter expressions.
>From what I understood from it, in a filter expression the context item
is only defined in the predicate, in a path expression it is defined for
all but the first steps (and all predicates).
Should give you 'something'.
More information about the talk