Comparing version 2.0.1 to 2.1.0
{ | ||
"name": "computron", | ||
"version": "2.0.1", | ||
"version": "2.1.0", | ||
"description": "Computron is a Node.js library to apply XSLT stylesheets to XML documents.", | ||
@@ -8,3 +8,3 @@ "main": "lib/binding.js", | ||
"scripts": { | ||
"build:config": "node tools/generateVSCodeConfig.js", | ||
"build:config": "./tools/generateVSCodeConfig.mjs", | ||
"build:debug": "node-gyp configure && node-gyp build --debug", | ||
@@ -23,13 +23,12 @@ "build": "node-gyp configure && node-gyp build", | ||
"license": "CECILL-2.1", | ||
"devDependencies": { | ||
"eslint": "^7.32.0", | ||
"eslint-config-semistandard": "^16.0.0", | ||
"eslint-config-standard": "^16.0.3", | ||
"eslint-plugin-import": "^2.25.3", | ||
"eslint-plugin-node": "^11.1.0", | ||
"eslint-plugin-promise": "^5.2.0" | ||
}, | ||
"dependencies": { | ||
"node-addon-api": "^4.2.0" | ||
}, | ||
"devDependencies": { | ||
"eslint": "^8.19.0", | ||
"eslint-config-standard": "^17.0.0", | ||
"eslint-plugin-import": "^2.26.0", | ||
"eslint-plugin-n": "^15.2.4", | ||
"eslint-plugin-promise": "^6.0.0" | ||
} | ||
} |
@@ -32,12 +32,20 @@ [![Build and test status](https://github.com/Inist-CNRS/computron/actions/workflows/build-and-test.yml/badge.svg)](https://github.com/Inist-CNRS/computron/actions/workflows/build-and-test.yml) | ||
computron.loadStylesheet('/path/to/stylesheet', (_err) => { | ||
if (_err) throw _err; | ||
// A stylesheet needs to be loaded on the current instance before doing anything | ||
try { | ||
computron.loadStylesheet('/path/to/stylesheet'); | ||
} catch (err) { | ||
console.error(err); | ||
process.exit(1); | ||
} | ||
// null is passed as second argument because the stylesheet doesn't take any parameters | ||
computron.apply('/path/to/xml', null, (err, result) => { | ||
if (err) throw err; | ||
// Apply the previously loaded stylesheet on the provided XML file | ||
let xmlResult; | ||
try { | ||
xmlResult = computron.apply('/path/to/xml'); | ||
} catch (err) { | ||
console.error(err); | ||
process.exit(1); | ||
} | ||
console.log(result); | ||
}); | ||
}); | ||
console.info(xmlResult); | ||
``` | ||
@@ -50,11 +58,26 @@ | ||
computron.loadStylesheet('/path/to/stylesheet-with-params', (_err) => { | ||
if (_err) throw _err; | ||
// A stylesheet needs to be loaded on the current instance before doing anything | ||
try { | ||
computron.loadStylesheet('/path/to/stylesheet/with/params'); | ||
} catch (err) { | ||
console.error(err); | ||
process.exit(1); | ||
} | ||
computron.apply('/path/to/xml', { param1Name: 'param1Value', param2Name: 'param2Value' }, (err, result) => { | ||
if (err) throw err; | ||
// Apply the previously loaded stylesheet on the provided XML file | ||
let xmlResult; | ||
try { | ||
// Parameters can be passed to the stylesheet | ||
const params = { | ||
param1Name: 'value1', | ||
param2Name: 'value2', | ||
}; | ||
console.log(result); | ||
}); | ||
}); | ||
xmlResult = computron.apply('/path/to/xml', params); | ||
} catch (err) { | ||
console.error(err); | ||
process.exit(1); | ||
} | ||
console.info(xmlResult); | ||
``` | ||
@@ -61,0 +84,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
5
94
57600
11