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

Subject: Re: [xsl] Testing 2 XML documents for equality - a solution
From: David Carlisle <davidc@xxxxxxxxx>
Date: Mon, 4 Apr 2005 14:19:39 +0100
> This is a nice feature provided by Saxon (infact very
> nice). And is much more optimized than the named
> template I wrote (in the stylesheet I posted last), as
> Saxon's function runs in native Java code.. 

For the vast majority of nodes this is still a) very expensive way of
comparing them and b) doesn't help with the comparison.

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. 

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?

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

Current Thread