[FIX] XQuery, maps: check for empty sequence. Closes #1012