Project

Profile

Help

Bug #5493

open

Problems with transform result output.resultDocuments

Added by Debbie Lockett 3 months ago. Updated about 2 months ago.

Status:
In Progress
Priority:
High
Category:
API
Sprint/Milestone:
Start date:
2022-05-17
Due date:
% Done:

0%

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 the forum (see resultDocuments property of transform call result not pop...), the transform results object resultDocuments property is not being populated as intended when deliverResultDocument requests the destination to be serialized.

There is some confusion in the documentation as to whether the transform options properties destination and resultForm affect secondary result documents, or just the principal result document. The destination info at https://www.saxonica.com/saxon-js/documentation2/index.html#!api/transform says it "Determines what happens to the principal result tree from the transformation" and does not mention secondary results (except for updating the HTML page in the browser); and it is clear that deliverResultDocument determines what happens to secondary results, with its own destination defined in the function return object. However https://www.saxonica.com/saxon-js/documentation2/index.html#!api/transform/results says:

As with the principal result document, the way in which secondary result documents are returned is determined by the options supplied to the transformation, in particular options.destination and options.resultForm

I think this statement is wrong for destination, I'm not sure about resultForm.

So when deliverResultDocument is not supplied, I don't think options.destination has any influence for the secondary results, and the default action in Node.js is to write to file. See the documentation for deliverResultDocument:

In the absence of the deliverResultDocument option, SaxonJS effectively uses a default in which:

  • destination is "html-page" if running in the browser, or "file" in Node.js;
  • save places the value in output.resultDocuments[URI], unless destination="file", in which case the value is written to filestore.

But it should be possible to supply a function for deliverResultDocument which returns an object with "destination" : "serialized", and no save property; to request that the secondary result documents should populate output.resultDocuments (by the default save function); but this currently fails.

Please register to edit this issue

Also available in: Atom PDF Tracking page