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

Re: [xsl] Evaluation of predicates (potential bug in MSXML .NET)


Subject: Re: [xsl] Evaluation of predicates (potential bug in MSXML .NET)
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Mon, 22 May 2006 13:51:26 +0200

At 2006-05-22 13:37 +0200, Buchcik, Kasimier wrote:
JFYI: In the following scenario, the result of MSXML .NET
differs from the results of Saxon, Xalan and Libxslt/Libxml2.

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

  <xsl:template match="/">
          <xsl:value-of select="count(//foo[name() = 'foo'][1])"/>

Which is to say, count all first-of-siblings named 'foo' at all levels of the document.


</xsl:template>

</xsl:stylesheet>

<?xml version="1.0"?>
<foo>
  <foo>
    <foo/>
    <foo/>
    <foo/>
  </foo>
</foo>

There are three points in the document at which there is a 'foo' amongst siblings.


Result of MSXML .NET:
<?xml version='1.0' encoding='utf-8' ?>
1

That is an incorrect result.


All the other processors return "3".

However, MSXML .NET returns "3", if we change the expression to
"count(//foo[1][1])".

That is also the count of all first siblings named 'foo' at all levels of the document.


. . . . . . . . . . . . . Ken

p.s. an XPath expression very similar to the above is one of the trick questions in the XPath portion of my training class.

--
Registration open for XSLT/XSL-FO training: Wash.,DC 2006-06-12/16
Also for XSL-FO/XSLT training:    Minneapolis, MN 2006-07-31/08-04
Also for XML/XSLT/XSL-FO/UBL training: Varo,Denmark 06-09-25/10-06
World-wide corporate, govt. & user group UBL, XSL, & XML training.
G. Ken Holman                 mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0    +1(613)489-0999 (F:-0995)
Male Cancer Awareness Aug'05  http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal


Current Thread
Keywords