[FIX] XQuery, Closes #1042.