xsl-list
[Top] [All Lists]

Re: How to verify equivalence of two node trees ?

2004-10-28 00:13:13
Maybe this draft W3C spec could help:

http://www.w3.org/2001/tag/doc/xmlChunkEquality.html


Cheers,
Dimitre.


On Thu, 28 Oct 2004 08:02:56 +0100, Michael Kay <mike(_at_)saxonica(_dot_)com> 
wrote:
You need to provide much more detailed specifications of your three equality
functions - you might like to look at the spec of deep-equals() in XPath 2.0
to see the kind of things you need to take into account (or decide not to
take into account). For example, does it matter to you whether the elements
have the same in-scope namespaces? Are whitespace-only text nodes
significant? Are comments and processing instructions significant?

It's a bit easier to write such functions in 2.0, but the essential
technique is the same as at 1.0: you will need a recursive function/template
that walks down the tree applying the same kind of test at each level.

Michael Kay 



-----Original Message-----
From: Matt Adams [mailto:mattad(_at_)email(_dot_)com]
Sent: 28 October 2004 06:36
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] How to verify equivalence of two node trees ?

Assume we have two node trees with the root nodes $aroot and $broot:

<xsl:variable name="aroot" select="...." />
<xsl:variable name="broot" select="...." />

How can I test the equivalence of the two node trees ?
More precisely there are should be three kinds of tests:

1.) Testing if tree a is equal to tree b only looking at the elements
but ignoring possible existing attributes and their values

2.) Testing if tree a is equal to tree b regarding the
elements and their
attributes but ignoring the values of the attributes

3.) Finally testing if tree a is equal to tree b regarding elements,
their attribute (names) and the attribbute values.

How can I implement such a test in XSLT?
Is there possibly a smarter solution in XSLT 2.0 ?

Matt
--
___________________________________________________________
Sign-up for Ads Free at Mail.com
http://promo.mail.com/adsfreejump.htm


--+------------------------------------------------------------------
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>
--+--



--+------------------------------------------------------------------
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>
--+--




<Prev in Thread] Current Thread [Next in Thread>