[xquery-talk] simple map operator
ms at basex.org
Mon Jul 9 01:01:21 PDT 2012
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 ! (: 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.
Am 09.07.2012 um 09:41 schrieb Jens Østergaard Petersen:
> 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,
> talk at x-query.com
More information about the talk