[xquery-talk] simple map operator
Michael Seiferle
ms at basex.org
Mon Jul 9 01:01:21 PDT 2012
Hi Jens,
they are relative, such that each step (E1 ! E2) will serve as the input sequence E'1 for the next operation (E'1 ! E'2), hence:
> <foo>
> <bar>hello</bar>
> <bar>world</bar>
> <bar>and</bar>
> <bar>hello</bar>
> <bar>universe</bar>
> </foo>/bar ! (: here we locate each <bar /> child of <foo /> :)
> upper-case(.) ! (: we return a sequence of their text() in upper-case :)
> substring(.,2,string-length(.)) (: we return a sequence of the upper case text and strip the first character :)
the map operator redefines the context items (inner focus) for each subsequent operation.
So it does not locate any special nodes within trees, but works on sequences of items you specify by expressions, for example:
> (1 to 5) ! (. + 1) ! (. * 2)
will work as well and returns (4, 6, 8, 10, 12).
Hope this helped to clear things up a little :-).
I guess others on this list will correct me if I got something wrong.
Kind regards
Michael
Am 09.07.2012 um 09:41 schrieb Jens Østergaard Petersen:
> Hi,
>
> Can anyone explain to me why the XQuery 3.0 simple map operator <http://www.w3.org/TR/xquery-30/#id-map-operator> is a relative path expression? Which nodes within trees does it locate?
>
> Thanks in advance for any enlightenment,
>
> Jens
> _______________________________________________
> talk at x-query.com
> http://x-query.com/mailman/listinfo/talk
More information about the talk
mailing list