Getting started
The middleware itself is a server which sits between its own server and the Xeditor client. The server itself takes care of the more demanding tasks that should not be performed on the client / browser.
The middleware replaces the old blackbox. The configuration can be migrated for this purpose.
Setup
Prereqiurements
- NodeJS 18.16.0 (latest LTS)
- NPM 9.5.1 (Usually comes along automatically with NodeJS.)
- Java JRE >= 11
- XSLT Processor
XSLT Processor
The middleware needs an XSLT processor to work correctly. This must always be installed additionally.
XSLTProc
XSLTProc is a popular xslt tool for linux. This can usually be easily installed via the package manager of the system:
# i.e. for Ubuntu
sudo apt install xsltproc
With the following configuration:
export var configuration = {
general: {
// ...
schema: {
// ...
"demo@0.0": {
transformer: 'xsltproc' // Default value
}
}
}
}
Saxon
Saxon is one of the best known programs for XSLT. It usually runs in Java and therefore also under Windows, Linux and MacOS.
# i.e. for Ubuntu
curl -o /tmp/saxon.zip -LO https://github.com/Saxonica/Saxon-HE/releases/download/SaxonHE12-3/SaxonHE12-3J.zip
unzip -o /tmp/saxon.zip /opt/saxon
With the following configuration:
export var configuration = {
general: {
// ...
schema: {
// ...
"demo@0.0": {
transformer: {
type: 'saxon',
config: {
location: '/opt/saxon/Saxon.jar'
//,config: 'path/to/config/file.xml'
}
}
}
}
}
}
Installation
The middleware can be easily installed via the NPM repository.
The package can either be installed globally on the system:
npm install @xeditor/middleware --global
Or via a package.json
file. This offers the additional advantage that the version can be easily managed:
{
"name": "xeditor-middleware-configuration",
"version": "1.0.0",
"scripts": {
"start": "xemiddleware --config ./xemiddleware.config.mjs"
},
"dependencies": {
"@xeditor/middleware": "3.0.0"
}
}
Running the middleware
The middleware can be executed via the xemiddleware
command. The parameter --help
can be used to display the corresponding help detail.
$ xemiddleware --help
xemiddleware.js 3.0.0
Usage: xemiddleware.js [args]
Config options:
-c, --config Path to the config file [string]
Developer options:
--debug Switch to debug mode [boolean]
Options:
-h, --help Show help [boolean]
-v, --version Show version number [boolean]
The next step is to configure the middleware.