xsl-list
[Top] [All Lists]

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

2006-05-22 04:52:15
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(_at_)CraneSoftwrights(_dot_)com
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


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--