Project

Profile

Help

Bug #3941

closed

Post-descent accumulator value not available within template rule for the matched element

Added by Michael Kay over 5 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Streaming
Sprint/Milestone:
-
Start date:
2018-10-03
Due date:
% Done:

100%

Estimated time:
Legacy ID:
Applies to branch:
9.8, 9.9
Fix Committed on Branch:
9.8, 9.9
Fixed in Maintenance Release:
Platforms:

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.

Actions #1

Updated by Michael Kay over 5 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.

Actions #2

Updated by Michael Kay over 5 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

Actions #3

Updated by O'Neil Delpratt over 5 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.

Actions #4

Updated by O'Neil Delpratt over 5 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

Also available in: Atom PDF