Two Variables for Collection Unions

View: New views
2 Messages — Rating Filter:   Alert me  

Two Variables for Collection Unions

by Abdalla Alothman :: Rate this Message:

Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message

Hello.

Is it possible to construct joins using a collection union with two
variables?

If we have:

query 'for $i in (collection("mycoll1.dbxml") | collection("mycoll2.dbxml"))/Root/Node1

instead of returning $i for both containers:

return($i/data/text(), $i/data/text())

is it possible to declare $x some way, somewhere and return it? As in:

return($i/data/text(), $x/data/text())

Thanks,
Abdalla Alothman


------------------------------------------
To remove yourself from this list, send an
email to xml-unsubscribe@...


Re: Two Variables for Collection Unions

by Chris Carlin :: Rate this Message:

Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message

Abdalla Alothman wrote:
> query 'for $i in (collection("mycoll1.dbxml") | collection("mycoll2.dbxml"))/Root/Node1
>
> instead of returning $i for both containers:
>
> return($i/data/text(), $i/data/text())
>
> is it possible to declare $x some way, somewhere and return it? As in:
>
> return($i/data/text(), $x/data/text())

I'm not sure what you're trying to do.

What would you like $x to be? Are you trying to run the same query
(/Root/Node1/.../data/text()) against the two collections independently
and return two independent result sets, one for $i and one for $x?

$x can be declared using let statements (let $x := ...), but because of
the functional nature of XQuery there are some restrictions on this.

~Chris


------------------------------------------
To remove yourself from this list, send an
email to xml-unsubscribe@...