Support #6101
closedxsl:import pathing
100%
Description
Hello
I'm running some Node on AWS Lambda, but struggling to get xsl:imports to work there.
My sources are both strings, with the XSL being XSL rather than compiled SEF.
This code works locally, when supplying a (Windows) path as TEMP_DIR.
const transformXml = (xml, xsl) => {
try {
const env = SaxonJS.getPlatform();
const xslDoc = env.parseXmlFromString(xsl);
// hack: avoid error "Required cardinality of value of parameter $static-base-uri is exactly one; supplied value is empty"
xslDoc._saxonBaseUri = `file://${TEMP_DIR}`;
const sef = SaxonJS.compile(xslDoc);
const result = SaxonJS.transform({
stylesheetInternal: sef,
sourceText: xml,
logLevel: 1,
});
return SaxonJS.serialize(result.principalResult, { method: "xml" });
} catch (error) {
console.error(`Transform err: ${error.message}`);
}
};
However, on Lambda, when the files that are xsl:import[ed] sit in /tmp, I get a "can't load file" error.
Where am I going wrong? Is SaxonJS.getResource a better approach? If so, could you point me to an example - I'm struggling to get something based on your docs working.
Regards John
Please register to edit this issue
Also available in: Atom PDF Tracking page