Project

Profile

Help

Bug #5471

closed

Results object from asynchronous SaxonJS.transform does not contain stylesheetInternal

Added by Debbie Lockett 11 days ago. Updated 4 days ago.

Status:
Closed
Priority:
Normal
Category:
API
Sprint/Milestone:
-
Start date:
2022-05-05
Due date:
% Done:

100%

Estimated time:
Applies to JS Branch:
2, Trunk
Fix Committed on JS Branch:
2, Trunk
Fixed in JS Release:
SEF Generated with:
Platforms:
Company:
-
Contact person:
-
Additional contact persons:
-

Description

As raised by Martin in a forum post a few months ago (https://saxonica.plan.io/boards/5/topics/8296): the results object contains stylesheetInternal from a synchronous SaxonJS.transform call, but not from an asynchronous one. Belatedly raising this as a bug.

Actions #1

Updated by Debbie Lockett 11 days ago

Unit test nodejs/saxonapi async-trans-007 added to reproduce the bug.

It turns out that for an asynchronous transform, we are actually still returning the updated options object, rather than just a transform results object (see https://www.saxonica.com/saxon-js/documentation2/index.html#!api/transform/results). I don't think this is what is intended. The options object will have been updated to add principalResult and resultDocuments, but stylesheetInternal is not updated (so it is only defined if this was supplied in the first place).

Note that in the documentation, under "Synchronous and asynchronous execution" (https://www.saxonica.com/saxon-js/documentation2/index.html#!api/transform/execution), it says:

If the second argument is the string "async" then the function fires off the transformation asynchronously, returning a Promise. The promise is fulfilled when the transformation completes, successfully or unsuccessfully. On successful completion, the value passed to the resolution function is the options object, updated to contain result information.

But I think that final sentence also needs updating. Elsewhere we always refer to the results object, e.g. lower on the page:

The argument supplied to the then method of the Promise is the JavaScript Object described at Transformation Results.

Actions #2

Updated by Debbie Lockett 10 days ago

  • Status changed from New to Resolved
  • Fix Committed on JS Branch 2, Trunk added

Fixed the code so that an asynchronous transform returns the right transform results object (in the resolved Promise). To improve the code (and closure compiler handling) I've added a class for this transform results object.

I've also updated the documentation, to correct details about SaxonJS.transform returning the results object not the updated options object.

Committed on saxonjs2 and main branches.

Actions #3

Updated by Debbie Lockett 4 days ago

  • Status changed from Resolved to Closed
  • % Done changed from 0 to 100
  • Fixed in JS Release set to SaxonJS 2.4

Bug fix applied in the SaxonJS 2.4 maintenance release.

Please register to edit this issue

Also available in: Atom PDF Tracking page