[xquery-talk] Looking to use XQuery as a reporting language
Ronald Bourret
rpbourret at rpbourret.com
Tue Oct 11 00:02:49 PDT 2005
Functions can easily return tuples. For example, the following function
returns the child elements of an input element:
define function children($e as element()) as element()*
{
$e/element()
}
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>
}
By the way, many of the XQuery specs are quite readable. I suggest
reading the main XQuery spec [1] and using the Functions and Operators
spec [2] for reference. The data model spec [3] is also useful, but a
bit thicker to read.
-- Ron
[1] http://www.w3.org/TR/xquery/
[2] http://www.w3.org/TR/xpath-functions/
[3] http://www.w3.org/TR/xpath-datamodel/
Nikolas Everett wrote:
> I've been looking into ways to do reports from one XML data set to another.
> When I found XQuery just last Friday I thought that I had hit the jackpot! A
> simple, functional language that both queries and outputs XML. All is going
> well, but I am having some trouble with output formatting, and I wonder if
> anyone could help me out.
>
> It looks as though function calls can only return three things in XQuery:
>
> 1. Some data (xs:string, xs:integer, or whatever)
> 2. An XML subtree
> 3. A tuple of XML subtrees
>
> My problem is that I have only found one way to return number 3: the FLWOR
> clauses. I am looking for something slightly more general. I would like to
> make a function return something more like:
> <foo>Some Text</foo>
> <bar>Some More Text</bar>
>
> I would read the specs, but they are so huge that I honestly don't know
> where to start.
>
> --Nik
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> talk at xquery.com
> http://xquery.com/mailman/listinfo/talk
More information about the talk
mailing list