Project

Profile

Help

Bug #6132 » testDocumentPoolWithXslEvaluate1.js

test case passes in documentPool to SaxonJS.transform but fails to resolve file for exposeXslEvaluate.xsl and some XPath expression accessing the document - Martin Honnen, 2023-07-18 18:51

 
const path = require('path');

const url = require('url');


const SaxonJS = require('saxon-js');

var xmlResource1 = SaxonJS.getResource({'type': 'xml', 'text' : '<root>foo</root>' });

var doc1Uri = 'doc1.xml';

var docPool = {};

xmlResource1.then(doc => { docPool[url.pathToFileURL(path.resolve('.', doc1Uri))] = doc; })
.then(() => {
console.log(docPool);
SaxonJS.transform({
documentPool: docPool,
stylesheetLocation: 'exposeXslEvaluate.xsl.sef.json',
stylesheetBaseURI: url.pathToFileURL(path.resolve('.', 'exposeXslEvaluate.xsl')),
initialFunction: 'Q{http://example.com/mf}eval',
functionParams: ['doc("doc1.xml")'],
destination: 'raw'
}, 'async').then(result => {
console.log(SaxonJS.serialize(result.principalResult));
});
});
(6-6/6)