How can get the XML with sorted attributes using XQuery in SQL?
for example for this XML:
Although the order of attributes has no semantic significance, one of the design goals of XML is to be human-readable, so it is not entirely unreasonable to try to generate lexical XML in which the order of attributes is consistent and reflects user expectations: for example
is easier on the eye than
. The Saxon serializer therefore has an option saxon:attribute-order
that allows the ordering of attributes in the output XML to be controlled: see http://www.saxonica.com/documentation/index.html#!extensions/output-extras/serialization-parameters