RE: [XQuery] 3.2 Path expressions returning non-nodes

What about á (U+03B1). That's a nice alliteration to apply.

 

OTOH, we could also rename the "for $i in Expr ... return ... " to "to $i in Expr ... apply ..."

 

Which means I can just use for $i in Expr return f($i)....

 

Best regards

Michael 

 

> -----Original Message-----

> From: public-qt-comments-request@w3.org [mailto:public-qt-comments-

> request@w3.org] On Behalf Of Michael Kay

> Sent: Tuesday, February 03, 2004 12:56 PM

> To: 'Sarah Wilkin'; public-qt-comments@w3.org

> Subject: RE: [XQuery] 3.2 Path expressions returning non-nodes

> 

> 

> 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 17:29:36 UTC