- From: Michael Kay <mhk@mhk.me.uk>
- Date: Tue, 3 Feb 2004 20:55:43 -0000
- To: "'Sarah Wilkin'" <swilkin@apple.com>, <public-qt-comments@w3.org>
I agree with you that a mapping operator of this kind is desirable, and have raised a public comment to that effect, because the requirement keeps coming up: http://lists.w3.org/Archives/Public/public-qt-comments/2003Dec/0061.html I don't think it's right to overload "/" with this functionality. The "/" operator causes elimination of duplicates and sorting into document order, and there are cases where this is absolutely necessary when processing nodes; it's hard to overload the semantics so that this only happens when the arguments are nodes (all nodes? some nodes?), and it doesn't make sense when the arguments are atomic values. In previous discussions among some XSL WG members, we have discussed using "!" for this mapping operator. (In very early discussions on the XPath task force I proposed "\", which was quite rightly ruled out). Michael Kay > -----Original Message----- > From: public-qt-comments-request@w3.org > [mailto:public-qt-comments-request@w3.org] On Behalf Of Sarah Wilkin > Sent: 03 February 2004 19:15 > To: public-qt-comments@w3.org > Subject: [XQuery] 3.2 Path expressions returning non-nodes > > > > 3.2 Path Expressions > "Each evaluation of E2 must result in a (possibly empty) sequences of > nodes; otherwise a type error is raised. [err:XP0019]" > > We feel XQuery is limited by its focus on nodes. The evaluation of E2 > should be able to contain nodes or atomic values. > > The main purpose of this is to allow for a function at the end of a > path. Generally this saves writing a loop. For example: > > let $root := <b><a> foo bar</a><a>baz faz</a></b> > return $root/a/normalize-space(.) > > instead of > let $root := <b><a> foo bar</a><a>baz faz</a></b> > let $seq := $root/a > let $result := for $item in $seq > return normalize-space($item) > return $result > > In addition, without this functionality ugly workarounds are required > to obtain the value of context functions. For example: > ("a", "b", "c" )/text{ position() } > > instead of the straightforward: > ("a", "b", "c" )/position() > > --Sarah >
Received on Tuesday, 3 February 2004 15:55:06 UTC