[xquery-talk] Help with an XQuery function

Liam R E Quin liam at w3.org
Tue May 15 09:48:14 PDT 2012


On Tue, 2012-05-15 at 11:29 -0400, Custer, Mark wrote:
[..]
> This works, but I was wondering if it could be written better (and I
> imagine that someone already has written a concise XQuery function to
> do this).

It might be easier to write it recursively, but clear is better than
concise.

>   Also, I'm not entirely sure why, but when I run the above function,
> I get the following result:
> 
> /a /b /c[3]

This is because you construct a sequence of strings. Use
string-join( your-function(), "")
to fix that.

Or it might be, string-join("", your-function()), I never remember,
which suggests it's the opposite of the other languages I use :-)

Liam

-- 
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/
Ankh: irc.sorcery.net irc.gnome.org freenode/#xml



More information about the talk mailing list