I have this simple XML file:
557 Fleece Pullover&
BaseX is just being strict about serialization. It won't complain if you force the attribute nodes into strings:
xquery doc("catalog.xml")/*/product/@dept/string()