https://github.com/transpect/javascript-extension
An extension step for XML Calabash to run JavaScript and NodeJS in XProc
https://github.com/transpect/javascript-extension
calabash javascript nodejs
Last synced: about 2 months ago
JSON representation
An extension step for XML Calabash to run JavaScript and NodeJS in XProc
- Host: GitHub
- URL: https://github.com/transpect/javascript-extension
- Owner: transpect
- License: bsd-2-clause
- Created: 2017-02-10T11:22:03.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2018-03-20T14:13:28.000Z (over 8 years ago)
- Last Synced: 2025-01-13T01:14:05.829Z (over 1 year ago)
- Topics: calabash, javascript, nodejs
- Language: Java
- Size: 17.2 MB
- Stars: 1
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# javascript-extension
An extension step for XML Calabash to run JavaScript and NodeJS in XProc
## Description
This step runs JavaScript code either by reading it from the input port or from a reference to an external file.
```xml
```
```xml
print('hello world')
```
The step implements the JavaScript engines [Rhino](https://github.com/mozilla/rhino) from Mozilla and [Nashorn](https://docs.oracle.com/javase/8/docs/technotes/guides/scripting/nashorn/) from Oracle and the [trireme](https://github.com/apigee/trireme) library from Apigee for running node.js scripts inside the JVM.
## Requirements
* Java 1.8
## XML Calabash Configuration
* add the path to `JavaScriptExtension.java` and the jar files in the `lib directory` to your Java classpath
* edit your XProc config and add the class file
```xml
```
### Limitations
NodeJS code is just executed with Trireme and Rhino. Trireme doesn't support the newer JavaScript engine Nashorn. Please also note that there are differences between the JavaScript implementation of Rhino and NodeJS. There is a detailed [list of supported features](http://mozilla.github.io/rhino/compat/engines.html) from Mozilla.