How to use the libxslt.parseFile function in libxslt

To help you get started, we’ve selected a few libxslt examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github microsoft / ELL / interfaces / javascript / swigToTypescript / templates / index.js View on Github external
var fs = require('fs');
var libxslt = require('libxslt');

var xsltFilename = process.argv[2];
var documentFilename = process.argv[3];
var outputFilename = process.argv[4];

libxslt.parseFile(xsltFilename, function (err, stylesheet) {
    if (err) {
        console.log("Error during XSLT parsing:");
        console.log(err);
        return;
    }

    stylesheet.applyToFile(documentFilename, function (err, result) {
        // err contains any error from parsing the document or applying the stylesheet 
        // result is a string containing the result of the transformation 
        fs.writeFile(outputFilename, result);
    });
});
github DefinitelyTyped / DefinitelyTyped / libxslt / libxslt-tests.ts View on Github external
stylesheet = libxslt.parse(document);

libxslt.parse('', (err, result) => {
	if (err == null) {
		stylesheet = result;
	}
});

libxslt.parse(document, (err, result) => {
	if (err == null) {
		stylesheet = result;
	}
});

libxslt.parseFile('/path/to/file', (err, result) => {
	if (err == null) {
		stylesheet = result;
	}
});

let applyOptions: libxslt.ApplyOptions = {};

applyOptions = {
	outputFormat: 'string',
	noWrapParams: true
};

let transformedString: string;

let transformedDocument: libxmljs.XMLDocument;

libxslt

[Fork] Node.js bindings for libxslt compatible with libxmljs

MIT
Latest version published 9 months ago

Package Health Score

62 / 100
Full package analysis