The saxon:attribute-order attribute

This serialization property is available with the XML, HTML, and XHTML output methods, to control the order in which attributes appear within an element start tag (in the absence of the property the order of attributes is unpredictable). Attributes whose names are listed in this property appear first, in the order they are listed; other attributes follow, sorted first by namespace URI and then by local-name.