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

Thank you, this is acceptable.

On Sep 14, 2004, at 11:19 AM, Don Chamberlin wrote:

>
> Dear Sarah,
> Thanks for your comment of Feb. 3, 2004 on this subject (attached 
> below). After considerable discussion, the XML Query and XSLT working 
> groups have decided to adopt your proposal. In the next edition of the 
> XQuery and XPath 2.0 specifications, the definition of a path 
> expression will be edited as follows:
>
> "Each operation E1/E2 is evaluated as follows: Expression E1 is 
> evaluated, and if the result is not a (possibly empty) sequence of 
> nodes, a type error is raised. [err:XP0019] Each node resulting from 
> the evaluation of E1 then serves in turn as an inner focus for an 
> evaluation of E2, as described in [Dynamic Context]. The sequences 
> resulting from all the evaluations of E2 are combined as follows:
>  (a) If every evaluation of E2 returns a (possibly empty) sequence of 
> nodes, these sequences are combined, and duplicate nodes are 
> eliminated based on node identity. <xpath-only>The resulting node 
> sequence is returned in document order.</xpath-only><xquery-only>If 
> ordering mode is "ordered", the resulting node sequence is returned in 
> document order; otherwise it is returned in implementation-dependent 
> order.</xquery-only>
>  (b) If every evaluation of E2 returns a (possibly empty) sequence of 
> atomic values, these sequences are concatenated, in order, and 
> returned.
>  (c) Otherwise (that is, if the multiple evaluations of E2 return at 
> least one node and at least one atomic value), an error is raised.
>  NOTE: Since each step in a path provides context nodes for the 
> following step, in effect, only the last step in a path is allowed to 
> return a sequence of atomic values."
>
> Please let us know whether you consider this to be an acceptable 
> response to your comment.
> Thanks and best regards,
>  --Don Chamberlin
>
> ----------------(referenced note)------------------
>
> 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, 28 September 2004 22:49:48 UTC