Re: [xsl] Equals (=)

Subject: Re: [xsl] Equals (=)
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Tue, 25 Sep 2001 16:42:39 -0400

At 03:43 PM 9/25/01, you wrote:
Hello all,
     I am sure this question is implementation-specific, and probably just
for my own knowledge, but perhaps a generalized response is possible.

     How does XSL compare two elements to see if they are equal?
i.e. <xsl:if test = "$element1=$element2>

In my current situation(comparing using Saxon), doing this seems to be
tremendously faster than comparing all of the children of element1 and
element2.  My assumption is that the parser hashes up each element and
compares them.  Is this correct?

Not exactly. It's only comparing string values of the nodes. And no, it's not implementation-specific. (How it's done internally may be, but the rules of what constitutes "equal" are not.)

The XPath spec [3.4] is really the place to go for this: it's a bit complex, but clearly enough explained. You need to know that the value of an element node is the concatenation of the values of its text node descendants.


Wendell Piez                            mailto:wapiez@xxxxxxxxxxxxxxxx
Mulberry Technologies, Inc.      
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
  Mulberry Technologies: A Consultancy Specializing in SGML and XML

XSL-List info and archive:

Current Thread