xslmin

An XSLT 1.0 minifier A tool to minify an XSL file so that it is as compact as possible. The primary goal of this tool is to compress XSL files used in client side XSLT in web browsers.

License

License

GroupId

GroupId

com.github.ricksbrown
ArtifactId

ArtifactId

xslmin
Last Version

Last Version

2.3.0
Release Date

Release Date

Type

Type

jar
Description

Description

xslmin
An XSLT 1.0 minifier A tool to minify an XSL file so that it is as compact as possible. The primary goal of this tool is to compress XSL files used in client side XSLT in web browsers.
Project URL

Project URL

http://maven.apache.org
Source Code Management

Source Code Management

https://github.com/ricksbrown/xslmin

Download xslmin

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.ricksbrown/xslmin/ -->
<dependency>
    <groupId>com.github.ricksbrown</groupId>
    <artifactId>xslmin</artifactId>
    <version>2.3.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.ricksbrown/xslmin/
implementation 'com.github.ricksbrown:xslmin:2.3.0'
// https://jarcasting.com/artifacts/com.github.ricksbrown/xslmin/
implementation ("com.github.ricksbrown:xslmin:2.3.0")
'com.github.ricksbrown:xslmin:jar:2.3.0'
<dependency org="com.github.ricksbrown" name="xslmin" rev="2.3.0">
  <artifact name="xslmin" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.ricksbrown', module='xslmin', version='2.3.0')
)
libraryDependencies += "com.github.ricksbrown" % "xslmin" % "2.3.0"
[com.github.ricksbrown/xslmin "2.3.0"]

Dependencies

compile (1)

Group / Artifact Type Version
org.apache.ant : ant jar 1.9.6

test (1)

Group / Artifact Type Version
junit : junit jar 3.8.1

Project Modules

There are no modules declared in this project.

xslmin

An XSLT minifier

The primary goal of this tool is to reduce the size of XSL files used in client side XSLT in web browsers.

xslmin performs the following minification tasks:

  • Deletes unused templates

  • Deletes unused variables

  • Deletes unused parameters

  • Strips comments

  • Strips ignorable whitespace

  • Renames local variables

  • Renames local parameters

  • Renames global variables

  • Does NOT rename global parameters (so you can still inject them)

  • Renames named templates

  • Normalizes space in attribute token lists, e.g. xsl:preserve-space

  • Collapses xsl:elements to short form e.g. <element name="foo"> becomes <foo>

  • Inlines xsl:attributes e.g.

     <element name="foo">
     	<attribute name="bar">
     		<value-of select="$foobar"></value-of>
     	</attribute>
     </element>

    becomes

     <foo bar="{$foobar}">

Usage

You can download the latest JAR from Maven Central

Executable Jar

java -jar xslmin.jar inputXslPath outputXslPath [-p[reserve]]

Ant Task

The easiest way is to use maven and the maven-antrun-plugin to fetch xslmin and then use it in your ant build like so:

<path id="project.class.path">
	<path path="${maven.plugin.classpath}"/>
</path>

<taskdef name="xslmin"
	classname="com.github.ricksbrown.xslmin.ant.MinifyTask"
	classpathref="project.class.path"/>

<xslmin in="${srcdir}/myxsl.xsl" out="${outdir}/myxsl.xsl" preserve="true"/>

Releases

2.3.0

  • Existing users note, the java classes have been repacked to the github namespace com.github.ricksbrown.xslmin.

  • Now available on Maven Central

     <dependency>
     	<groupId>com.github.ricksbrown</groupId>
     	<artifactId>xslmin</artifactId>
     	<version>2.3.0</version>
     </dependency>

TODO

  • Merge identical templates
  • Detect recurring long text and move to global variable

Versions

Version
2.3.0