Ed Davies wrote:
> Svante Schubert wrote:
>> I stumbled over a strange behavior in saxonb8-9j when comparing a string
>> with an empty node set:
>> <xsl:message>EQUAL result into <xsl:value-of
>> select="notexistingelmeent = 'SEARCH_STRING'"/>!</xsl:message>
>> <xsl:message>UNEQUAL result into <xsl:value-of
>> select="notexistingelmeent != 'SEARCH_STRING'"/>!</xsl:message>
>> Both result into false! I would have assumed that the negation of one
>> expression would result into the other, therefore unequal would be 'true'.
> This is not technically a Saxon specific question as it is
> general to any XSLT processor, but...
> The left hand side of both your (in)equalities is a sequence.
> The comparison operators "match" any element in the sequence
> (they are existentially quantified) so the first would be true
> if there was any "notexistingelmeent" equal to 'SEARCH_STRING'.
> Similarly, the second would be true if there was any element in
> the sequence which was not equal to the string.
> If the sequence is empty then there is no element which is
> equal so the result for "=" is false and, similarly, there
> is no element which is different so again for != the result
> is false.
You are right, it was obviously a wrong assumption that boolean algebra
could be used upon the comparison operators.
The general comparisons equal and unequal are not inverses of each other
(and not transitive for themselves).
Thanks for your help Ed!
> (By the way, our illustrious leader's XPath 2.0 book describes
> the = operator (and the other general comparison operators) in
> detail starting on page 188 but doesn't reference this page
> under «=» in the index, where it does reference other pages
> discussion this operator. I sort-of knew these rules but
> wanted to double check.)