Created
March 14, 2017 14:01
-
-
Save kornman00/86af858f491bd2f501edee2f09c610da to your computer and use it in GitHub Desktop.
Sort non 1st level XML elements and their attributes for better diffing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<xsl:stylesheet version="1.0" | |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> | |
<xsl:output omit-xml-declaration="yes" indent="yes"/> | |
<xsl:strip-space elements="*"/> | |
<xsl:template match="node()|@*"> | |
<xsl:copy> | |
<xsl:apply-templates select="@*"> | |
<xsl:sort select="name()"/> | |
</xsl:apply-templates> | |
<xsl:apply-templates select="node()"> | |
<xsl:sort select="name()"/> | |
<xsl:sort select="text()" /> | |
</xsl:apply-templates> | |
</xsl:copy> | |
</xsl:template> | |
</xsl:stylesheet> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment