[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Is "A != B" equivalent to "not(A = B)"?
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|