XSLT 2.0 or 3.0 for Node.js?

2020-05-07 04:20发布

问题:

I've been looking for a node module that supports XML to HTML/XSL version 2.0 transformations via XSLT. I'm confined to developing in a windows environment, and have researched many alternatives including Saxon/C (saxon-node), node_xslt, gulp-xslt, and some others.

I haven't found a solution that satisfies our needs. Most solutions seem to require a linux or mac osx environment for development.

Any ideas? I greatly appreciate the help in advance!

回答1:

Your best bet for XSLT in Node.js would be Saxon-JS, which is a XSLT 3.0 runtime in pure JavaScript1. Note that you'll need Saxon-EE, a commercial product, to compile your XSLT, but once that's done, you can freely deploy the result and the runtime. As a bonus, Saxon-JS implements not only XSLT 2.0 but XSLT 3.0 as well.


1Caveat: Saxon-JS will clearly be your best bet once Saxonica adds support for parsing and serialization to the JavaScript runtime. Before then, these limitations will severely restrict the suitability of Saxon-JS to many projects, including possibly yours.