Sometimes XML files needs to be stored in some VCS. Such files are often edited using GUI tools which can reorder the elements each times as they want.
Also VCS merging is usually line-oriented, and often XML files either looks likes one long line or fully indented like
<foo>
<bar>
<name>
n3
</name>
<value>
qqq3
</value>
</bar>
<bar>
<name>
n2
</name>
<value>
qqq2
</value>
</bar>
</foo>
, while they should look like
<foo>
<bar> <name> n2 </name> <value> qqq2 </value> </bar>
<bar> <name> n3 </name> <value> qqq3 </value> </bar>
</foo>
(e.g. "partially indented") to be more human readable/editable, compact. One simple logical unit should occupy one line.
Even if somebody converts XML file to such nice format, someone else will edit it in GUI tool that will reorder and reintent everything and it will be bad (unreadable and VCS will report massive changes despite of there are almost no actual changes).
Is there ready made XSLT transformation (or other program) that converts all XML files to some unified format (e.g. sorts (if element order do not matter) and unifies whitespace) and where I can specify which elements should be oneliners?
For example, if I can specify such transformation as filter in .gitattributes
and git will automatically handle this.