-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Saxon.js on the server? #1
Comments
No, this is not possible using the GWT technology on which Saxon-CE depends. GWT explicitly targets the browser environment. Michael Kay On 13 Oct 2013, at 13:23, streaps wrote:
|
Hi, 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. |
Forgot; tested this on Ubuntu; it should be possible to make it portable to mac and Windows too |
Hi Martin, Node.js is an interest technology that I never got around to trying out or needed to use. However, Saxon/C and node.js seems like an project worth pursuing from an XSLT prospective. I have added the xsl-list and the Saxon mailing-list to this email to see if anyone from the XSLT community who has experience of using node.js would find this project of use and interesting. Kind regards, O'Neil
O'Neil Delpratt |
Message from Rob Koberg from the [email protected] http://lists.mulberrytech.com/ in regards to Saxon/C and Node.js: This will have problems because you are using a string instead of a I use grunt to call out to the command line to trigger an ant build file task.
O'Neil Delpratt |
This is but one of the methods replicated from the SaxonProcessor.cpp and XsltProcessor.cpp provided in the Saxon/C interface. The straight file is another method. For me I don't have files because I'm using RESTful interfaces so this was an illustration of doing it. The methods of http://www.saxonica.com/saxon-c/doc/html/XsltProcessor_8h_source.html are being added(but not wrapped) directly to the module |
For files it is/will be possible to code: var pdbContent = xsltProcessor.xsltApplyStylesheet(global.inputXmlPath); The objective is to bring in the stylesheet once, compile it once and apply multiple times |
XsltProcessor(SaxonProcessor* proc, bool license=false, string cwd=""); can set the working directory |
Had some interest in a private email. One person said especially if we can call the XML Schema 1.1 validator. We intend to provide EE support in the next release. How can I setup Saxon/C with node.js to play with it myself. O’Neil
O'Neil Delpratt |
I'll stand up a github project tonight after work and give you a script to pull and try it. There aren't many dependencies: "dependencies" : {
"co" : "4.0.0",
"co-fs" : "1.2.0",
"should" : "4.3.0",
"mocha-co" : "1.17.1-co.1"
},
and native Saxon/C and needs to be at least nodejs v0.11.x for the --harmony switch |
Thinking parameters can be added to the javascript xsltProcessor.parameters.elements-of-interest="'C', 'H'"; and be used during the transformations |
I am also interested in trying it out: it would make it easier to integrate Saxon XSLT transformations to generate static pages in Web development projects where other developers already have node.js installed, but may be reluctant to install Ant + a Java JDK. |
Would not think you need to install Ant + a Java JDK. The Saxon/C library has everything you need in a self contained package. O'Neil Delpratt |
Well, I haven't tried Saxon/C yet, but a layer of scripting is typically needed to configure the flow of transformations, and I am not going to write it in C++. Apache Ant offers portability for this type of scripts. |
The repository is Will add the direct file, parameters and properties over the weekend. Any particular feature needed? Will pull to my work computer and make a typical script to use npm to install, build with gyp and run the one lonely test. Next week will publish it so npm can pull it into other projects |
I got a bit of saw dust; rewriting to call the Saxon/C SaxonProcessor and XsltProcessor objects. Hold off trying it for a bit.... |
Sure. I probably won’t get a chance to look at it until tomorrow.
O'Neil Delpratt |
Ok, reconstructed and it is possible to test. Next week it will have more features |
I installed Saxon/C using the setup script (32 bits), and I installed nodejs v0.11.14 from source, on Ubuntu 12.04. So far so good. The installation of saxon-node with npm fails during An error is reported: |
You'll need a compiler compatible with c++11 standard and later. gcc is 4.7 and later. I'll write more about the compiler in the readme.md. I haven't tried 32 bit yet but nothing is set to require 64 bit https://gcc.gnu.org/projects/cxx0x.html
I installed Saxon/C using the setup script (32 bits), and I installed nodejs v0.11.14 from source, on Ubuntu 12.04.The installation of saxon-node fails during node-gyp rebuild.An error is reported: |
@rimmartin I would rather avoid recompiling, which requires (parts of) a Java JDK if I understand this bit from your README correctly:
I feel like it would be easier to include the Saxon/C libraries and the precompiled JavaScript binding code bundled in the saxon-node module. Does it make sense? |
I'll be writing a clearer readme.md. You do not need to get the Excelsior JET [- Java Virtual Machine (JVM) and Native Code Compiler] and compile the libsaxon.so; Saxonica does that and has worked out the only license needed is Saxonica's. |
@eric-brechemier - Ah you're thinking about prebuilt and completely packaged ready to go. Have to think about where I would put such releases for download. Currently this is geared toward publishing as a module on https://www.npmjs.com/package/saxon-node where it can be included in other node project's package.json and build with everything else that package includes. |
Exactly.
The Saxon/C libraries alone are not that large... but if you don't want to include a bundle for all platforms, perhaps the install could download the prebuilt library that corresponds to the target platform? Is the extra compilation step still needed in this case? |
Yea the glue code src/SaxonProcessor.cpp [a working copy from ./Saxon-HEC0.3.1/Saxon-C-API] still needs to compile; it is not source that is already compiled into libsaxon.so. It is compiled/linked directly with the https://github.com/rimmartin/saxon-node/blob/master/src/SaxonProcessorJS.hpp the native v8/nodejs code and the runtime of it is in /build/Release/obj.target/saxon.Xslt.node file |
@eric-brechemier I'm looking for what is done to deploy or deliver prebuilt node modules and how parent node projects would call them; learn how to package for it. If it is possible. (my Ubuntu is 14_04). Or I could build it on amazon ec2 with Ubuntu 12_04, zip it up and email it to you. Know more by this weekend |
@rimmartin Thanks for looking into it, I appreciate. Don't worry about my particular target platform; I can contribute the build for Ubuntu 12.04 (32 bit) if it comes to this. |
Has anyone got a list of dependencies for this to build? I am trying to build it on OSX and getting a lot of errors like so:
When building on CentOS VM I get different errors:
These are lines cut from a middle of many, many lines of debug output. I can post full messages if needed... |
Would it be possible to make a version that could run on node.js?
The text was updated successfully, but these errors were encountered: