[xquery-talk] Query to return nested xml tags

padmapriya ayyagari asn.padmapriya at gmail.com
Fri Dec 3 22:07:03 PST 2004


Hello everyone,

Firstly thanks for all your prompt responses to my queries. They were
really helpful.

My question might sound repetitive, but the problem is that I'm using
the GALAX api for xpath and xquery. Unfortunately, it doesn't accept
some of the standard xquery syntax (not even 'doc', it uses 'document'
instead!!!!). So, in order to obtain the result nodes of an xquery in
XML format : that is:

<site>
<persons>
<name>
XYZ
</name>
</persons>
</site>

I'm using the following , rather 'roundabout' way of doing so. Please
note that the api doesn't seem to recognize functions either (!!!), so
recursive calls cannot be made.

I have written the following query, but when I try to execute it :

" let $open := fn:string-join(for $p in $n/ancestor-or-self::* return
fn:concat(\"<\",fn:name($p),\">\"), \"\") let $app := \"\" let $close
:= string-join(for $p in $n/ancestor-or-self::* let $app :=
fn:concat(\"</\",fn:name($p),\">\",$app) return $app,\"\") return
fn:concat($open,$n,$close)";

It still gives me :

<site>
<persons>
<name>
XYZ
</site>
</persons>
</name>

Even on changing the order of the $app and other arguments in the
second concat, it doesn't seem to work!

Could someone please help me?

Thanks,
Padmapriya


More information about the talk mailing list