[xsl] Bug in Xalan 2.4.1?

Subject: [xsl] Bug in Xalan 2.4.1?
From: glaprade <glaprade@xxxxxxxxxx>
Date: Tue, 21 Jan 2003 12:11:57 -0700
I am using the xslt-process module for Emacs and am attempting to produce an
example as to why comparing 2 node sets with the = or != operators is
problematic.  xslt-process allows me to switch between Xalan 2.4.1 and Saxon
6.5.2 for my XSLT processor.

I believe I've discovered a bug in Xalan 2.4.1.

XML FILE:
<Employees>
  <Employee status="fulltime" pay="salaried">
    <FirstName>Jeff</FirstName>
    <LastName>Smith</LastName>
    <SSN>323345333</SSN>
  </Employee>
  <Employee status="parttime" pay="hourly">
    <FirstName>Mike</FirstName>
    <LastName>Young</LastName>
    <SSN>222176543</SSN>
  </Employee>
  <Employee status="parttime" pay="salaried">
    <FirstName>George</FirstName>
    <LastName>Castanza</LastName>
    <SSN>121345123</SSN>
  </Employee>
</Employees>

XSL FILE:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
  <xsl:output method="xml" indent="yes" encoding="UTF-8"/>

  <xsl:template match="/">
    <root>
      <xsl:variable name="NodeSet1" select="/Employees/Employee[1]"/>
      <xsl:variable name="NodeSet2" select="//Employee"/>
      
      <xsl:if test="$NodeSet1 = $NodeSet2">
	<Equal/>
      </xsl:if>
      <xsl:if test="$NodeSet1 != $NodeSet2">
	<NotEqual/>
      </xsl:if>
    </root>
  </xsl:template>
</xsl:stylesheet>



With Saxon 6.5.2 selected I get:
   <?xml version="1.0" encoding="UTF-8"?>
   <root>
      <Equal/>
      <NotEqual/>
   </root>


With Xalan 2.4.1 selected I get:
   F:/stuff/XSLT/equal_notequal_gotcha.xsl:13:38: Fatal error: Unknown error
in XPath
which points to this line:
   <xsl:if test="$NodeSet1 != $NodeSet2">


MSXML 4 will output the same as Saxon.

I believe this is a bug, but wanted to ensure that there is nothing wrong
with my not equal comparison.

Thanks,
Greg

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


Current Thread