On a somewhat related note, it would be really nice if there was an extension to Emacs somewhere that would let you look up the query in the .xql file when your cursor is over the query reference in a .tcl file. Anyone built such a beast?
I have lost time in debugging because I thought the query in the tcl file was getting run, when it was really being pulled from an xql somewhere.