Project

Profile

Help

Feature #5021

closed

Option to supply base URI of the source text in SaxonJS.getResource() for Node.js

Added by Yury Palyanitsa over 3 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Low
Category:
-
Sprint/Milestone:
-
Start date:
2021-06-11
Due date:
% Done:

100%

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

Description

I am having a case, when I would like to use the base-uri() function for a resource I resolved with SaxonJS.getResource({text: <source_text>, type: "xml"}). The reason for that is I need to resolve the links that are relative to the document I resolved using its text, while embedding it into the document I use in SaxonJS.transform().

I was trying the following approaches in my attempt to make it work:

  1. Use text and location options together (like it is done in SaxonJS.transform()) then use a stylesheet parameter to access the resolved document — the text option is ignored and the document is resolved using the location option.
  2. Use only text option and supply the {"<source_uri>": "<resource_object>"} in documentPool then use doc($<source_uri>) to access the document — the document is still fetched by its URI instead of provided resource.

I noticed that when I am using the "location" option, the object is provided with _saxonBaseUri and _saxonDocUri options that contain the URI of the resolved document. I tried providing _saxonBaseUri and _saxonDocUri directly in the resource I got, and it actually worked!

So, is there a proper way to do what I described in case I am doing it wrong? And if not, then is it possible to provide such option to align the behavior with SaxonJS.transform()?

Please register to edit this issue

Also available in: Atom PDF Tracking page