helloWorld.Saxon-JS for Node.js

By Norm Tovey-Walsh on November 15, 2020 at 05:53p.m.

You may already have seen my helloWorld.Saxon-JS posting. That was about getting Saxon-JS working in your browser. This post is about getting Saxon-JS working in Node.js.

I’m still tinkering with some personal projects and I’ve decided that for one of them, I’m going to experiment with using Node.js. The app is going to do its thing and then eventually I’m going to want to build a web page to show the results.

I’m sure there are ways to do this in Node.js, but this is pretty much the first ever thing I’ve built in node, so I don’t know what they are. What I do know is that I’ve got a wodge of JSON and I want to turn it into a web page.

XSLT to the rescue. And XSLT on the server side this time.

As before, I was able to follow the documentation and get it up and running. But once again, it involved a lot more head scratching (and re-reading the SaxonJS.transform API page) than I would care to admit. This time, I think the main difficulty was my inexperience with node more than anything else.

What I would have liked this time was a simple Node.js project that pulled all the pieces together so that I could build it and see it working, and then begin to hack on it.

So I built one: https://github.com/Saxonica/helloWorldNodeJS.

There’s really nothing to show, it’s about getting it to run locally, but I think the TL;DR is pretty straightforward.