node_xslt

A simple XSLT package for node.js

npm install node_xslt
40 downloads in the last day
156 downloads in the last week
445 downloads in the last month

node_xslt

xslt = require('node_xslt')

stylesheet = xslt.readXsltString(string);
// readXsltString
// Arguments: string containing XSLT
// Returns: stylesheet object

stylesheet = xslt.readXsltFile(filename);
// readXsltFile
// Arguments: filename to file containing XSLT
// Returns: stylesheet object

document = xslt.readXmlString(string);
// readXmlString
// Arguments: string containing XML
// Returns: document object

document = xslt.readXmlFile(filename);
// readXmlFile
// Arguments: filename to file containing XML
// Returns: document object

htmlDocument = xslt.readHtmlString(string);
// readHtmlString
// Arguments: string containing HTML
// Returns: document object

htmlDocument = xslt.readHtmlFile(string);
// readHtmlFile
// Arguments: filename to file containing HTML
// Returns: document object

transformedString = xslt.transform(stylesheet, document, parameters);
// transform
// Arguments:
//  * stylesheet: stylesheet object
//  * document: document object
//  * parameters: an array of parameters to be passed to the stylesheet. length must be multiple of 2.
//        Example: ['param1Name', 'param1Value', 'param2Name', 'param2Value']

Requirements

  • libxml2 (libxml2-dev package for Debian-based distros)
  • libxslt (libxslt-dev package for Debian-based distros)
  • libexslt (libxslt-dev package for Debian-based distros)
  • xml2-config (Needs to be on PATH)

Installation

npm

npm install node_xslt

source

In the root directory, run `node-gyp rebuild` to generate
./build/Release/node_xslt.node
npm loves you