[xquery-talk] Query to return nested xml tags
Michael Kay
mhk at mhk.me.uk
Sat Dec 4 14:48:25 PST 2004
What you are doing seems to be completely weird, but you presumably have
your reasons. I can't see why you expect it to produce the opening tags in
one order and the closing tags in a different order. The result of
ancestor-or-self::* is in document order, that is, outermost element first,
and that's what you are seeing.
Michael Kay
http://www.saxonica.com/
> -----Original Message-----
> From: talk-bounces at xquery.com
> [mailto:talk-bounces at xquery.com] On Behalf Of padmapriya ayyagari
> Sent: 04 December 2004 03:07
> To: talk at xquery.com
> Subject: [xquery-talk] Query to return nested xml tags
>
> 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
> _______________________________________________
> talk at xquery.com
> http://xquery.com/mailman/listinfo/talk
>
More information about the talk
mailing list