[xquery-talk] Focus & function callsites

John Snelson john.snelson at oracle.com
Fri Feb 15 14:55:02 PST 2008


Hi Frans,

You have not taken into account the document order sort and duplicate 
elimination that happens because local:function() is called on the right 
hand side of the "/" operator. This eliminates one of the results that 
you were expecting to see.

John

Frans Englich wrote:
> Hi,
> 
> I need a hand here, what is this query supposed to evaluate to?
> 
> 	declare variable $root := <root><c/></root>;
> 
> 	declare function local:function($arg)
> 	{
> 	    $root[$arg]
> 	};
> 
> 	$root//local:function(.)
> 
> My conclusion is(ignoring whitespace):
> 
> <root>
>     <c/>
> </root>
> <root>
>     <c/>
> </root>
> 
> because $root// returns two nodes: <root><c/> and <c/>, and hence 
> local:function is invoked twice with $arg being those values.
> 
> Since the effective boolean value of a node is true, $root is returned both 
> times.
> 
> X-Hive & Saxon disagree with me. What am I missing?
> 
> 
> Cheers,
> 
> 		Frans
> _______________________________________________
> talk at x-query.com
> http://x-query.com/mailman/listinfo/talk


-- 
John Snelson, Oracle Corporation            http://snelson.org.uk/john
Berkeley DB XML:        http://www.oracle.com/database/berkeley-db/xml
XQilla:                                  http://xqilla.sourceforge.net


More information about the talk mailing list