[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] Is "A != B" equivalent to "not(A = B)"?

Subject: [xsl] Is "A != B" equivalent to "not(A = B)"?
From: "Michael S." <mjs@xxxxxxxxx>
Date: Sat, 27 Apr 2002 18:11:32 +1000

I've got a stylesheet that produces different results depending on whether I use "A != B" or "not(A = B)"? Is this supposed to happen? Can someone explain why? It's not very intuitive.

This is my XML document:

<p>"Hallo, <cast>Eeyore</cast>!" said <cast>Pooh</cast>. "This is <cast>Tigger</cast>."</p>
<p>"What is?" said <cast>Eeyore</cast>.</p>
<p>"This," explained <cast>Pooh</cast> and <cast>Piglet</cast> together, and <cast>Tigger</cast> smiled his
happiest smile and said nothing.</p>

The stylesheet that follows is supposed to pick out the cast members:


<xsl:template match="/">
<xsl:apply-templates select="//cast[text() != following::cast/text()]"/>

<xsl:template match="cast">
<p><xsl:value-of select="."/></p>


This actually "works" in xsltproc--I get the output I was expecting:

<?xml version="1.0"?>

However, saxon, xalan and sablotron give:

<?xml version="1.0" encoding="utf-8"?><root><p>Eeyore</p>

That is, there are duplicates, which I wasn't expecting--but since three out of four processors give this result, I figure it must be the correct result.

However, if the XPath expression line is changed to:

<xsl:apply-templates select="//cast[not(text() = following::cast/text())]"/>

All four processors give the same result, the result given by xsltproc, above. What's going on?



XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list

Current Thread