RE: [xsl] Sorting the complete xml file

Subject: RE: [xsl] Sorting the complete xml file
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Wed, 7 Dec 2005 16:05:35 -0000
> The primary reason that I want to do this is to see if 2 
> generated xml files are identical.

You mean, you want to see if they differ only in the order of the elements.

You could try:

<xsl:template match="*">
  <xsl:copy>
    <xsl:copy-of select="@*"/>
    <xsl:apply-templates select="node()">
        <xsl:sort select="."/>
    </xsl:apply-templates>
  </xsl:copy>
</xsl:template>


Michael Kay
http://www.saxonica.com/

Current Thread