XML Query, like XSLT, is a functional language free of
side-effects. This turns out to be a really good match
for working with XML, but means you need to be happy writing
recursive functions.
XML Query supports recursive functions, and
also sets of user-defined functions defined in separate modules.