This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: Equals (=)
- To: <xsl-list at lists dot mulberrytech dot com>
- Subject: RE: [xsl] Equals (=)
- From: "Michael Kay" <mhkay at iclway dot co dot uk>
- Date: Wed, 26 Sep 2001 11:23:39 +0100
- Reply-To: xsl-list at lists dot mulberrytech dot com
> 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?
>
No; the meaning of this construct is to compare the string value of element1
with the string value of element2. Saxon implements it by getting the string
value of both elements and comparing them.
Saxon's internal routine to walk all the descendant text nodes of an element
to assemble its string value is going to be a lot more efficient than doing
the same thing at stylesheet level. But note, it's possible for two elements
to have the same string value and yet not have the same structural content,
for example
<element>text</element>
is "equal" to
<element><x>text</x></element>
Mike Kay
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list