RE: [xsl] A difference in node builds

Subject: RE: [xsl] A difference in node builds
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Mon, 8 Sep 2003 15:28:18 +0100
It seems to me to be very likely that the two nodes differ in the
whitespace that they contain. Without seeing more detail, that's all I
can really say.

I'm not an enthusiast for deep-equal(). I think people have too many
different notions of what equality actually means. "Equal modulo
whitespace text nodes" is another example of such a notion.

Michael Kay

> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of 
> Vorndran, Charles P
> Sent: 08 September 2003 12:36
> To: 'XSL-List@xxxxxxxxxxxxxxxxxxxxxx'
> Subject: [xsl] A difference in node builds
> 
> 
> I am having some difficulties using deep-equal() in Saxon 
> 7.6.5 and the problem doesn't seem to be in the function.  
> Instead, the problem seems to be in the nodes that are being 
> compared and how those nodes are built.
> 
> To verify that deep-equal() works, I created an xsl test 
> environment that creates two nodes from two xml files on the 
> file system, using the
> document() function.  I then compared these nodes with 
> deep-equal().  When one file is actually a copy of the other, 
> deep-equal() returns a true on the comparison.  When I modify 
> one of the input files structurally, deep-equal() returns a 
> false.  So, I'm satisfied that deep-equal() works, at least 
> for what I want.
> 
> The problem is, in the real application I create a node, 
> NODE1, with data extracted from a larger xml input file, and 
> compare NODE1 to NODE2 which is imported from a file (FILE1) 
> using document().  FILE1 was built from a previous run of the 
> same stylesheet, essentially being derived from a node that 
> is now represented by and should have been identical to 
> NODE1.  Even though I know that nothing has changed between 
> runs, deep-equal() indicates that the new NODE1 and the 
> imported NODE2 are not the same.  Yet the files created from 
> the two nodes, using xsl:result-document and the same output 
> format, are identical according to diff.
> 
> Another reason why I suspect a node difference is that when I 
> change the output format to text (using xsl:output 
> method="text"), the text characters are the same but the 
> spacing, linefeeds and tabbing are drastically different.  
> Yeah, I know, whitespace differences shouldn't come into play 
> here but it does seem to cloud things up a bit.
> 
> So, I guess it's back "How do I inspect a node that is in 
> memory?" unless someone can give me some other suggestions as 
> to what's happening.
> 
> Thanks
> 
> Chuck Vorndran
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread