xsl-list
[Top] [All Lists]

RE: Testing 2 XML documents for equality - a solution

2005-04-04 06:39:12
 
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.


cheers
andrew

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--