The sorting is done in javascript using a plugin that does it's own type inference. The strinfigication is necessary because scala's XML parser isn't always smart enough to just call `toString` on objects. This is one such case (when you are setting the value of an XML attribute).