0.1.0 • Published 4 years ago

ts-xsltproc v0.1.0

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

node-xsltproc

Build Status

Wrapper for xsltproc.

Getting Started

First install the xsltproc if not already installed on your system read installing an XSLT processor.

Install the module with: npm install node-xsltproc --save

var xsltproc = require('node-xsltproc')

var xslt = xsltproc.transform('stylesheet.xsl', 'data.xml');

xslt.stdout.on('data', function (data) {
  console.log('xsltproc stdout: ' + data);
});

xslt.stderr.on('data', function (data) {
  console.log('xsltproc stderr: ' + data);
});

xslt.on('exit', function (code) {
  console.log('xsltproc process exited with code ' + code);
});

Example using a string parameter:

var xsltproc = require('node-xsltproc')

xsltproc.transform('stylesheet.xsl', 'data.xml', {
  "profile": true,
  "output": "test.txt",
  "stringparam": {
    "key": 'title',
    "val": 'This is a single parameter passed as subtitle----anvidsahviulasdhvklasdbcuw'
  },
});

It is also possible to use multiple string parameters:

var xsltproc = require('node-xsltproc')

xsltproc.transform('stylesheet.xsl', 'data.xml', {
  "profile": true,
  "output": "test.txt",
  "stringparam": [
    {
      "key": 'title',
      "val": 'This is a single parameter passed as subtitle----anvidsahviulasdhvklasdbcuw'
    },
    {
      "key": 'anotherTitle',
      "val": 'This is a another single parameter passed'
    }
  ],
});

License

Copyright (c) 2014 Ilya Rogov. Licensed under the MIT license.