Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return through.obj(function(file, enc, callback) {
var context = getContext(file);
var t = this;
// output(context);
var templateXMLPath = getXMLPath(file, context);
var templateXSLPath = getXSLPath(file, context);
if(debug) gutil.log(templateXMLPath, templateXSLPath);
var documentString = renderer.renderFile(templateXMLPath, context);
context.xmlDocumentString = documentString.replace('', '');
var stylesheetString = renderer.renderFile(templateXSLPath, context);
output(documentString);
output(stylesheetString);
libxslt.parse(stylesheetString, function(err, stylesheet) {
if (err) {
alwaysOutput('\n\n' + stylesheetString);
t.emit('error', new PluginError({
plugin: 'MdtoXSLT',
message: 'Error parsing xsl stylesheet: ' + file.path + '; failed with error: ' + err
}));
return callback();
}
stylesheet.apply(documentString, {}, function(err, result) {
if (err) {
gutil.log(file.path);
alwaysOutput('\n\n' + documentString);
t.emit('error', new PluginError({
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);
});
});
/**
* @module manifest-model
*/
const libxml = require( 'libxslt' ).libxmljs;
const url = require( 'url' );
const path = require( 'path' );
const fs = require( 'fs' );
const config = require( './config-model' ).server;
const client = require( 'redis' ).createClient( config.redis.cache.port, config.redis.cache.host, {
auth_pass: config.redis.cache.password
} );
const utils = require( '../lib/utils' );
const debug = require( 'debug' )( 'manifest-model' );
// in test environment, switch to different db
if ( process.env.NODE_ENV === 'test' ) {
client.select( 15 );
}
/**
client.get( manifestKey, ( error, manifest ) => {
if ( error ) {
reject( error );
} else if ( manifest && manifest !== 'null' ) {
debug( 'getting manifest from cache' );
resolve( manifest );
} else {
debug( 'building manifest from scratch' );
const doc1 = libxml.parseHtml( html1 );
const doc2 = libxml.parseHtml( html2 );
const themesSupported = config[ 'themes supported' ] || [];
let resources = [];
// href attributes of link elements
resources = resources.concat( _getLinkHrefs( doc1 ) );
resources = resources.concat( _getLinkHrefs( doc2 ) );
// additional themes
resources = resources.concat( _getAdditionalThemes( resources, themesSupported ) );
// translations
resources = resources.concat( _getTranslations( lang ) );
// any resources inside css files
resources = resources.concat( _getResourcesFromCss( resources ) );
client.get( manifestKey, ( error, manifest ) => {
if ( error ) {
reject( error );
} else if ( manifest && manifest !== 'null' ) {
debug( 'getting manifest from cache' );
resolve( manifest );
} else {
debug( 'building manifest from scratch' );
const doc1 = libxml.parseHtml( html1 );
const doc2 = libxml.parseHtml( html2 );
const themesSupported = config[ 'themes supported' ] || [];
let resources = [];
// href attributes of link elements
resources = resources.concat( _getLinkHrefs( doc1 ) );
resources = resources.concat( _getLinkHrefs( doc2 ) );
// additional themes
resources = resources.concat( _getAdditionalThemes( resources, themesSupported ) );
// translations
resources = resources.concat( _getTranslations( lang ) );
// any resources inside css files
resources = resources.concat( _getResourcesFromCss( resources ) );
const document: libxmljs.XMLDocument = libxslt.libxmljs.parseXmlString('');
let stylesheet: libxslt.Stylesheet;
stylesheet = libxslt.parse('');
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
import * as libxslt from 'libxslt';
import * as libxmljs from 'libxmljs';
const document: libxmljs.XMLDocument = libxslt.libxmljs.parseXmlString('');
let stylesheet: libxslt.Stylesheet;
stylesheet = libxslt.parse('');
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;
import * as libxslt from 'libxslt';
import * as libxmljs from 'libxmljs';
const document: libxmljs.XMLDocument = libxslt.libxmljs.parseXmlString('');
let stylesheet: libxslt.Stylesheet;
stylesheet = libxslt.parse('');
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;
}
});
import * as libxslt from 'libxslt';
import * as libxmljs from 'libxmljs';
const document: libxmljs.XMLDocument = libxslt.libxmljs.parseXmlString('');
let stylesheet: libxslt.Stylesheet;
stylesheet = libxslt.parse('');
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) => {
import * as libxslt from 'libxslt';
import * as libxmljs from 'libxmljs';
const document: libxmljs.XMLDocument = libxslt.libxmljs.parseXmlString('');
let stylesheet: libxslt.Stylesheet;
stylesheet = libxslt.parse('');
stylesheet = libxslt.parse(document);
libxslt.parse('', (err, result) => {
if (err == null) {
stylesheet = result;
}
});
libxslt.parse(document, (err, result) => {
if (err == null) {
stylesheet = result;