Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Different order of XML nodes in a new solution

Sorting XML

If your reference and current XML structures are in a different order you can run below XSLT to sort them before comparision:

Code Block
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:template match="@* | node()">
		<xsl:copy>
			<xsl:apply-templates select="@* | node()"/>
		</xsl:copy>
	</xsl:template>
	<xsl:template match="<PARENT>">
		<xsl:copy>
			<xsl:apply-templates select="@* | node()[not(self::<CHILD>)]"/>
			<xsl:apply-templates select="<CHILD>">
				<xsl:sort select="<SORT_BY>" order="ascending"/>
			</xsl:apply-templates>
		</xsl:copy>
	</xsl:template>
</xsl:stylesheet>  

<PARENT> - node name of the parent node of the node to be sorted

<CHILD> - node to be sorted

<SORT_BY> - by which field in <CHILD> it should be sorted