This will have problems because you are using a string instead of a
file. The base path of the input document will resolve to the script
rather than the location of the XML. This is also a problem for many
of the node/xml modules, because they mostly (from what I can tell)
convert the file into a string before the parse.
I use grunt to call out to the command line to trigger an ant build file task.
On Tue, Jan 6, 2015 at 5:27 PM, O'Neil Delpratt oneil(_at_)saxonica(_dot_)com
<xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> wrote:
Hi,
A Saxon user on the Saxon-CE github mailing list proposed a way to use XSLT
with Node.js. I have never used Node.js, but it seems like an interesting
project from its description.
I am asking if anyone from the XSLT community who has experience of using
node.js would find this project of use and interesting. See email below from
github user rimmartin:
Hi,
for nodejs I put some c++ glue together to make a V8/node module work with
Saxon/C http://www.saxonica.com/saxon-c/index.xml instead of Saxon-CE.
Typical node code is
try
{
var content = yield fs.readFile(global.inputXmlPath, "utf8");
var saxonProcessor = new saxon.SaxonProcessor(false);
var xsltProcessor = saxonProcessor.newTransformer();
xsltProcessor.compile(global.xslPath);
xsltProcessor.parseXmlString(content);
var pdbContent = xsltProcessor.xsltApplyStylesheet();
console.dir(pdbContent);
}
catch (err) {
console.dir(err.message);
}
Works like a charm. It is based on nodejs --harmony using the new yields and
generators.
Would this be of interest to the xslt and node communities?
To do: I need to implement parameters and properties. Can readily add xquery
processor as well.
-------------------------------
O'Neil Delpratt
Software Developer, Saxonica Limited Email: oneil(_at_)saxonica(_dot_)com
Tel: +44 118 946 5894
Web: http://www.saxonica.com
Saxonica Community site: http://dev.saxonica.com
Bug tracking site: https://saxonica.plan.io/
XSL-List info and archive
EasyUnsubscribe (by email)
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--