Skip to content

copy-3002 - applicability of accumulators #50

@michaelhkay

Description

@michaelhkay

I think copy-3002 should fail because the accumulator is not applicable.

We're doing this:

    <xsl:variable name="v" as="element()">
      <xsl:copy-of select="//*[@x='a3-4']" copy-accumulators="yes"/>
    </xsl:variable>
    <xsl:value-of select="$v/accumulator-before('latest-pick'), 
                          $v/accumulator-after('latest-pick') "/>

so we're looking at an accumulator on a temporary tree that was copied from the accumulator values on the principal source document. The spec says (in §18.2.2 #5)

For a document containing nodes supplied in the initial match selection, the accumulators that are applicable are those determined by the xsl:mode declaration of the initial mode. This means that in the absence of an xsl:mode declaration, no accumulators are applicable.

and rule 6 says:

For a tree T created by copying a node in a tree S using the copy-of or snapshot functions, or the instruction xsl:copy-of with copy-accumulators="yes", an accumulator is applicable to T if and only if it is applicable to S.

Taking these rules together, the accumulator is not applicable to the initial match selection, therefore it is not applicable to $v, therefore the test should fail with XTDE3362.

I proposed to fork the test, creating one variant with the stylesheet unchanged, expecting an error, and another variant that corrects the error by making the accumulator applicable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions