xsl-list
[Top] [All Lists]

[xsl] Order of accumulator rules

2020-07-27 11:33:09
Hello everone,

I started to play with XSLT 3 accumulators and am not sure I
understand the specifications correctly with regards to the order of
accumulator rules.

Take the following example:

<xsl:transform version="3.0"
               xmlns:xs="http://www.w3.org/2001/XMLSchema";
               xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>

  <xsl:output method="text"/>

  <xsl:mode on-no-match="shallow-skip" use-accumulators="#all"/>

  <xsl:accumulator name="accumulator" as="xs:integer" initial-value="0">
    <xsl:accumulator-rule match="element">
      <xsl:sequence select="1"/>
    </xsl:accumulator-rule>
    <xsl:accumulator-rule match="element">
      <xsl:sequence select="2"/>
    </xsl:accumulator-rule>
  </xsl:accumulator>

  <xsl:template match="/">
    <xsl:apply-templates/>
    <xsl:sequence select="accumulator-after('accumulator')"/>
  </xsl:template>
</xsl:transform>

And apply it to the following document:

<element/>

From my reading of the specs I would expect value of the accumulator
to be 2 because both rules match the element node and the rule
selecting 2 is last in document order. But this stylesheet returns 1
when I run it with Saxon EE 10.1.

This seems to be a bug in Saxon, doesn't it?

Best,
  -- David

-- 
David Maus M.A.

Www: http://dmaus.name
Twitter: @_dmaus
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--

<Prev in Thread] Current Thread [Next in Thread>