eXtended XSL TransformationsNginx module for XSL Transformations


XXSLT is a Nginx module providing the processing of data and content in a way similar to ESI (Edge Side Includes). XXSLT empower XSL style sheet parsing directly in source code and dynamic content includes. We can use XXSLT module to:
  1. Process embedded blocks of XXSLT (xslt + include directive) commands in any document. Download XML data and define XSL stylesheets directly in processed document.
  2. Insert downloaded content directly to the page source.

XXSLT module can simplify:

  1. Caching the page parts (separation of dynamic and static components)
  2. Integrating of multiple online services (ex. rss feeds, xml interfaces)
  3. Application scaling (data generated on different servers and merge using xxslt)

Look at the example at the end of this document.


Put all sources to correct directories: (*.c, *.h, config)


When compiling from source use standard -add-module option as below:

./configure --add-module=src/http/modules/xxslt --add-module=src/http/modules/download --add-module=src/http/modules/mxcache

After configure simply compile and install nginx from terminal:

make install


XXSLT Module:

These are default values. Download/cache timeout and cache expire values can be set directly in include directive.

MXCache Module:

Download Module:


  location /xxslt {
	xxslt on;
	xxslt_cache_expire 5m;
	xxslt_cache_timeout 200ms;
	xxslt_download_timeout 1500ms;

	mxcache on;
	mxcache_server_port 11211;


<include ... />



Process embeded blocks of XXSLT (xslt + include directive) commands in any document

Module allows to download XML data and define XSL stylesheets directly in processed document.

You can use xslt with include tag in two ways:

 	<include ... name="name1" dca="xslt" />

	[xslt instructions]
	<include ... name="name2" dca="xslt" />
 	[xslt instructions]

Pay attention to the fact that the xml data included above are available below in the page. Structure of the global XML document containing all includes is as follows:

		[included data]
		[included data]




		<include src="http://rss.weather.com.au/nsw/sydney" name="weather" dca="xslt" alt="weather_rss_error.xml" ttl="300" maxwait="1500"/>

		<xsl:stylesheet version="1.0" 
			xmlns="http://www.w3.org/1999/xhtml" xmlns:w="http://rss.weather.com.au/w.dtd">
			<xsl:output method="xml" indent="yes" omit-xml-declaration="yes" encoding="UTF-8"/>
			<xsl:template match="/">
				<xsl:for-each select="//weather/rss/channel/item/w:forecast">
						<img src="{@iconUri}" alt="{@iconAlt}"  class="weather" />
						<ul class="weather">
							<li><b>Day: </b> <xsl:value-of select="@day" /></li>
							<li><b>Min temp: </b> <xsl:value-of select="@min" />C </li>
							<li><b>Max temp: </b> <xsl:value-of select="@max" />C </li>

Module will download RSS containing XML data and present it using declared stylesheet. If an error occurs rrs_error.xml will be used instead of the rss. Includes are cached if mxcache module is enabled.

Raw data include:

When dca is set to "none" (default), an included object will be included as flat text.


	<div id="menu">
			<include src="menu1.html" name="menu" ttl="500"/>

This will include content of the file into the page source. Includes are cached if mxcache module is enabled.


XXSLT is licensed under the Apache License, Version 2.0 which you can obtain from: http://www.apache.org/licenses/LICENSE-2.0