[xquery-talk] Looking to use XQuery as a reporting language

Michael Kay mhk at mhk.me.uk
Tue Oct 11 09:59:37 PDT 2005

> Functions can easily return tuples.

Well, sequences, actually. Tuples don't exist in the data model, though they
are used internally to describe the semantics of "order by".

> A function that returns what you want might look like:
> define function my_func() as element()*
> {
>    <foo>Some Text</foo>
>    <bar>Some More Text</bar>
> }

It actually needs a comma:

define function my_func() as element()*
   <foo>Some Text</foo>,
   <bar>Some More Text</bar>

Element constructors can be adjacent when they are part of the content of
another element constructor, but not when they are freestanding expressions.
Confusing, but you get used to it.

Michael Kay

More information about the talk mailing list