| 注册
请输入搜索内容

热门搜索

Java Linux MySQL PHP JavaScript Hibernate jQuery Nginx
zakes
8年前发布

Saxon-Node: Modern XSLT, XQuery and XPath in Node.js

来自: https://github.com/rimmartin/saxon-node

saxon-node

An exploration of binding Saxon/C http://www.saxonica.com/html/saxon-c/index.html (XSLT 2.0/3.0, XQuery 1.0/3.0, Schema Validation 1.0/1.1 and XPath 2.0/3.0).

Note: A major API change is in progress. The method names are being upgraded to mirror http://www.saxonica.com/saxon-c/doc/html/index.html . New functionality is being exposed.

Note: release v0.1.1 is built with nodejs v4.2.x [v4.2.x has Buffer acting like Uint8Array and currently is indistinguishable on the native side yet seems to work for this project]. If you want v0.12.x compatibility stay with v0.0.5. npm will continue with nodejs v4.2.x line and any fixes or features needed by prior versions will be from github branches.

To tell it where the Saxon/C is set the environment variable SAXONC_HOME to path:

export SAXONC_HOME=/home/user/Software/Saxonica/Saxon-HEC1.0.0

Prebuilts

linux-x64,linux-ia32, darwin-x64 and win32-ia32.

npm install --fallback-to-build

will first try to find a compatible native prebuilt. If it works you won't need development tools and compilers.

Building (only if needed; contact me if there is a particular prebuild you would use)

If a compatible prebuilt is not found, a number of environment variables are needed. For the build phase, as with integrating Saxon/C interface code in c/c++ applications the jni.h is needed. Set JAVA_HOME and the binding.gyp locates the jni.h from there. Only the headers are used; libsaxon.so that comes wth Saxon/C is loaded from it's home folder. The libsaxon.so depends on $SAXONC_HOME/rt during runtime and it needs library paths $SAXONC_HOME:$SAXONC_HOME/rt/lib/amd64/jetvm:$SAXONC_HOME/rt/lib/amd64. rt is the runtime http://www.excelsiorjet.com/ that Saxon/C provides. Note: The SAXONC_HOME needs to

To run it needs the harmony switch and at least nodejs v4.2.x. Make sure there isn't a java path to jvm in front of the Excelsior JET tool in rt folder:

export LD_LIBRARY_PATH=$SAXONC_HOME:$SAXONC_HOME/rt/lib/amd64/jetvm:$SAXONC_HOME/rt/lib/amd64:$LD_LIBRARY_PATH  node --harmony saxon-node.js /home/user/testing-grounds/BCL/analyze.xml /home/user/NetBeansProjects/OOBackbone/stylesheets/divconIsSpecies.xsl

Yet this isn't the purpose to run xslt as this small app. The intention is the calling of the API from your applications.

To test

export LD_LIBRARY_PATH=$SAXONC_HOME:$SAXONC_HOME/rt/lib/amd64/jetvm:$SAXONC_HOME/rt/lib/amd64:$LD_LIBRARY_PATH  mocha --harmony --require should

Documentation: Saxon Node API

 本文由用户 zakes 自行上传分享,仅供网友学习交流。所有权归原作者,若您的权利被侵害,请联系管理员。
 转载本站原创文章,请注明出处,并保留原始链接、图片水印。
 本站是一个以用户分享为主的开源技术平台,欢迎各类分享!
 本文地址:https://www.open-open.com/lib/view/open1455494970448.html
Node.js XSLT Node.js 开发 XPath