[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
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 17:34:54 +0100 |
> For e.g. we need to convert documents to UTF-8 No, you don't (although it is easy to do that in XSLT, just set xsl:output encoding="utf8") If you generate two strings in XSLT and compare them within the stylesheet they are strings of unicode characters not strings of bytes so encodings such as utf8 or ISO-8859-1 are irrelevant. Such encodings are mappings between bytes and Unicode characters. > I think, there are also other > canonicalization conversion rules which cannot be > easily done with XSLT. The point is not to necessarily use exactly the canonicalisation in "canonical XML" but to use whatever canonical form _you_ want to use for your comparison. For example if you want commenst to be ignored you write a template that discards commenst (the default one will do for that) if you want the presence of comments to be relevant but not their content, which is odd but what the Xpath2 deep-equal function uses, then you use a template that convers all commentst to some unique string, etc. Basically your stylesheet is doing exactly as I suggest, just generate a string for each document and compare those strings. But for some reason you want to generate a special purpose (and _very_ _very_ large) string representation of the XML file, rather than just use the normal text markup representation. 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Testing 2 XML documents f, Mukul Gandhi | Thread | Re: [xsl] Testing 2 XML documents f, Mukul Gandhi |
Re: [xsl] Testing 2 XML documents f, Mukul Gandhi | Date | Re: [xsl] xsl: preserving spaces p, josh higgins |
Month |
Keywords