It's even more surprising that the bug went unnoticed. It's not
covered by the XQJ test suite either. We've fixed the bug and added
some test cases; please have a look at the latest sources or the
latest versions from the Maven repository:
http://www.inf.uni-konstanz.de/dbis/basex/maven/org/basex/basex/6.2/basex-6.2.jar
http://www.inf.uni-konstanz.de/dbis/basex/maven/org/basex/basex-api/6.2/basex-api-6.2.jar