misterion / gulp-import-xslt

Import several xslt files into a single file

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

gulp-import-xslt

NPM version Build Status Code Climate Test Coverage

Import several xslt files into a single file, one by one, rebasing urls and inlining import/include nodes

Install

Install with npm.

npm install --save-dev gulp-import-xslt

Usage

Gulpfile.js:

var gulp = require('gulp');
var importXslt = require('gulp-import-xslt');

gulp.task('default', function () {
  gulp.src('templates/*.xsl')
    .pipe(importXslt())
    .pipe(gulp.dest('dist/'));
});

Options

  • prettyMethod ('minify'/'prettify') to pretty-print or minify text in XSLT. It based on node-js pretty-data plugin.

Examples

In case this is templates/sample.xsl:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:import href="page.xsl" />
	<xsl:template match="/">
		My sample
	</xsl>
</xsl:stylesheet>

And this is templates/page.xsl:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:template name="page">
	   Hello world!
	</xsl:template>
</xsl:stylesheet>

And result is:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:template name="page">
       Hello world!
	</xsl:template>
	<xsl:template match="/">
    	My sample
    </xsl>
</xsl:stylesheet>

Now, run the command gulp to get the combined xslt file.

License

Released under the MIT license.

About

Import several xslt files into a single file

License:MIT License


Languages

Language:JavaScript 100.0%