[xml] xpath mixed type equality expressions



I have a little problem with the xsl docbook stylesheets, which don't
behave as expected with xsltproc. The problem can be condensed to the
following:

  <xsl:template name="test" match="*">
    <xsl:variable name="value">1.0</xsl:variable>
    <xsl:choose>
      <xsl:when test="$value != 1.0">
        <xsl:message>UNEQUAL</xsl:message>
      </xsl:when>
      <xsl:otherwise>
        <xsl:message>EQUAL</xsl:message>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

This will print UNEQUAL when run trough xsltproc, although I believe
that the XPath spec (section 3.4) specifies that it should print EQUAL, 
since the test attribute is an EqualityExpression with a node-set and a
number as operands. Such an expression shall evaluate to true if any
node x in the node-set yields the given number when fed through
number(string-value(x)). 

libxml does't really implement this, but rather converts the number to a
string (which converts 1.0 into "1") and then compares the
string-value(x) with the resulting string (in xmlXPathEqualNodeSetFloat)

I think this is a bug in libxml.

Matthias




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]