RE: [xsl] Testing 2 XML documents for equality - a solution

Subject: RE: [xsl] Testing 2 XML documents for equality - a solution
From: "Andrew Welch" <ajwelch@xxxxxxxxxxxxxxx>
Date: Mon, 4 Apr 2005 14:39:12 +0100
> For a given element node if you calculate an XPath to the
> current node, and then use that XPath to find a node in the
> other document, you have two nodes, you then need to compare
> whether they are equal, but that is _exactly_ the problem you
> are trying to solve. The earlier stylesheet just took the
> string value of the node but that is just the concatenation
> of all the element content so loses most of the markup information.

True enough, I would suggest restricting it to data-centric XML, or
adding a special case for mixed content nodes.  I really think the aim
here is to keep it as simple as possible, rather than create the
de-facto comparison stylesheet.

> What is wrong with the much simpler alternative of just
> writing out the string corresponding to a specific
> "canonical" linearisation, and then jsut comparing those two strings?

I guess because how do you map back to the element/attribute that
doesn't match once you've done the comparison.


Current Thread