RE: [xsl] xsl != not working?

Subject: RE: [xsl] xsl != not working?
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Tue, 21 Jun 2005 19:03:20 +0100
  The basic test is:
> 
> //h2[1]/text() != text()
> 

Whenever you see A!=B, chances are it should be not(A=B)

The expression above is true if there is some h2 whose text is not equal to
the text of the current element. You probably want it to be true if there is
no h2 whose text equal to the text of the current element.

Also, using text() like this is usually wrong. An element can contain
comments and processing instructions as well as text nodes. Usually you want
to test the string value of the element, not the content of its text nodes.
Use

not(//h2[1] = .)

(But this might still be wrong, I haven't studied the problem you are trying
to solve).

Michael Kay
http://www.saxonica.com/

Current Thread