gugu / node_xslt

a simple XSLT addon for node

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

node_xslt

xslt = require('node_xslt')
fs = require('fs')

fs.readFile('test.xsl', function (err, xsltString) {
    if (err) throw err;

    stylesheet = xslt.readXsltString(xsltString);

    fs.readFile('cdcatalog.xml', function (err, xmlString) {
        if (err) throw err;

        doc = xslt.readXmlString(xmlString);
        transformedString = xslt.transform(stylesheet, doc, []);
        console.log(transformedString);
    });

    fs.readFile('cdcatalog.html', function (err, htmlString) {
        ir (err) throw err;

        doc = xslt.readHtmlString(htmlString);
        transformedString = xslt.transform(stylesheet, doc, []);
        console.log(transformedString);
    });
});

Requirements

  • libxml2
  • libxslt
  • xml2-config (Needs to be on PATH)
  • node-waf & v8.h (Both come with node)

Installation

npm

npm install node_xslt

source

In the root directory, run `node-waf configure build` to generate
./build/default/node_xslt.node

About

a simple XSLT addon for node


Languages

Language:C++ 49.9%Language:C 47.2%Language:JavaScript 2.9%