- From: Sarah Wilkin <swilkin@apple.com>
- Date: Tue, 3 Feb 2004 11:15:16 -0800
- To: public-qt-comments@w3.org
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