[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

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

Subject: Is "A != B" equivalent to "not(A = B)"?
From: "Michael S." <mjs@xxxxxxxxx>
Date: Sat, 27 Apr 2002 18:11:32 +1000
a or b equivalent
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:

<root>
<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>
</root>


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

<xsl:stylesheet
  version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>

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

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

</xsl:stylesheet>

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

<?xml version="1.0"?>
<root><p>Eeyore</p>
<p>Pooh</p>
<p>Piglet</p>
<p>Tigger</p>
</root>

However, saxon, xalan and sablotron give:

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

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?



Michael

--
http://beebo.org


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



Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.