Bug #3941
closedPost-descent accumulator value not available within template rule for the matched element
100%
Description
When an accumulator rule, say with match="item"
, uses the new option saxon:capture="yes"
, and accumulator-after() is called within the template rule for match="item"
, the captured snapshot of the matched item element is not available when the accumulator-after() function is executed.
See forum post 7321 from Martin Honnen.
Updated by Michael Kay about 6 years ago
It seems this has nothing to do with saxon:capture.
We only have one test (accumulator-051) that uses accumulator-after()
to read the post-descent value of an accumulator during processing of the end tag for the matched element, and the version of that test that is designed for streaming is not actually using streaming, because it fails to declare <xsl:mode streamable="yes"/>
.
When I change accumulator-051s to be properly streamable, I get an error: XTDE3420: Cannot call accumulator-after except during the post-descent phase of a streaming template
So I think there is a general problem that the post-descent accumulator value is not available early enough, and that accumulator-after() is either seeing the old value or failing.
======
I have fixed WatchManager.endElement() so it runs accumulator actions before other actions. This fixes the corrected test case accumulator-051s. But the test case for this bug is now failing
Error evaluating (.) in xsl:accumulator-rule/@select on line 12 column 90 of acc-phase-end-streaming-sax-capture1.xsl:
XPDY0002: The context item is absent
The reason is that we need to process the closedown action for the snapshot feed before we process the accumulator phase=end rules.
Updated by Michael Kay about 6 years ago
- Subject changed from saxon:capture - result not available within template rule for the matched element to Post-descent accumulator value not available within template rule for the matched element
- Category changed from Saxon extensions to Streaming
- Status changed from New to Resolved
- Applies to branch 9.8 added
- Fix Committed on Branch 9.8, 9.9 added
Fixed (both accumulator-051s and the new test case, which is now capture-204 in XSLT3-extra) by changing WatchManager.endElement() to change the order in which it processes registered closedown actions. In phase 0 it now closes any Snapshot feeds; in phase 1 it processes phase=end accumulator rules, and in phase 2 it does everything else (typically executing user code)
Copied the changed code from 9.9 to 9.8, even though part of the logic is really only needed to support saxon:capture which is new in 9.9
Updated by O'Neil Delpratt about 6 years ago
- % Done changed from 0 to 100
- Fixed in Maintenance Release 9.8.0.15 added
Bug fix applied in the Saxon 9.8.0.15 maintenance release. Leave open to the Saxon 9.9 maintenance release.
Updated by O'Neil Delpratt about 6 years ago
- Status changed from Resolved to Closed
- Fixed in Maintenance Release 9.9.0.2 added
Bug fix applied in the Saxon 9.9.0.2 maintenance release.
Please register to edit this issue