I am getting this error: [XQST0054] Stack Overflow: circular variable declaration? Do you know which can cause this?
Does your query contain any Java bindings? If yes, please have a look at the latest snapshot; a minor bug has been fixed in this version [2].
Hope this helps, Christian
PS: if you are using Java calls, it may be interesting to hear which code you are calling, and if those features could also be contained in future XQuery modules.
[1] http://docs.basex.org/wiki/Releases [2] https://github.com/BaseXdb/basex/pull/342