[FIX] XQuery: repeated call of exhausted iterator. Closes #909