[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 14:15:32 UTC