Node.js 上的 SaxonJS

SaxonJS on Node.js

我正在尝试 运行 一个空的简单代码片段来测试 Windows 10 上 NodeJs v8.11.1 上的 SaxonJS 1.1.0。

require('./Saxon-JS-1.1.0/SaxonJS.js');

但是我得到了这个错误:

PS C:\XXX\sandbox\xsl-transformation> node main.js
C:\XXX\xsl-transformation\Saxon-JS-1.1.0\SaxonJS.js:17136
        setPlatform(JSTestDriver.platform);
                    ^
ReferenceError: JSTestDriver is not defined
at initialize (C:\XXX\sandbox\xsl-transformation\Saxon-JS-1.1.0\SaxonJS.js:17136:25)

查看源码,我明白了:

function initialize() {
    "use strict";
    if (inBrowser) {
        setPlatform(BrowserPlatform.platform);
        saxonPrint("Saxon-JS " + getProcessorInfo().productVersion + " in browser", 0);
    } else {
        // Currently only Nashorn. (Later need to distinguish from Node case)
        // Nashorn JSTestDriver
        setPlatform(JSTestDriver.platform);
        saxonPrint("Saxon-JS " + getProcessorInfo().productVersion + " in 
   Nashorn");

        // node NodePlatform
    }

    if (typeof platform.initialize === "function") {
        platform.initialize();
    }
}

似乎没有实现节点平台。

然而,在documentation中是这样写的:

We're talking here primarily about running Saxon-JS in the browser. However, it's also capable of running in server-side JavaScript environments such as Node.js (not yet fully supported in this release).

我深入搜索了 SaxonJS/NodeJS 的代码片段,但没有找到。 有人有在 NodeJS 上工作的 SaxonJS 代码片段吗?

恐怕文档有些仓促。我们确实有用户报告在 Node.js 下将代码获取到 运行,我们自己已经完成了 "in the lab",但它需要对已发布的产品进行源代码调整。发布时,代码 运行s 在两个平台下,浏览器平台和 Nashorn(在 Nashorn 下,它假定我们的测试工具未发布)。

我们正在为 Node.js 开发一个版本。正确地做到这一点,因为产品需要浏览器版本中没有的许多功能,例如 XML 解析和序列化、调试支持、命令行界面和 API 等