in reply to XML::Lite --sort order in a keys() statement...

After looking at the docs, I think you're shooting yourself in the foot by using keyattr. It's converting what would have been an array into a hash, thus loosing ordering of records.