[xquery-talk] Focus & function callsites

Frans Englich frans.englich at telia.com
Fri Feb 15 15:32:08 PST 2008


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


More information about the talk mailing list