ngx_http_xslt_module
Transform XML responses with XSLT stylesheets
Overview
ngx_http_xslt_module is a filter that transforms XML responses using one or more XSLT stylesheets. Stylesheets are compiled at configuration time and applied in the order given, and parameters can be passed to them either inline with xslt_stylesheet or through xslt_param and xslt_string_param.
The module requires the libxml2 and libxslt libraries. It ignores the external DTD subset of the processed XML and instead uses the character entity file named by xml_entities. Since 1.31.3 loading of external entities declared in the internal DTD subset is off by default and controlled by xml_external_entities, which should only be enabled for trusted XML. Responses are transformed when their MIME type is text/xml or one listed in xslt_types.
It is an official nginx module that upstream does not build by default, so it needs the --with-http_xslt_module configure parameter. The n.wtf packages build it as a dynamic module shipped in libnginx-mod-http-xslt-filter, for example to render XML from a backend or an autoindex listing as HTML.
Key directives
xslt_stylesheetStylesheet with optional param=value pairs, compiled at configuration time; may be repeated. location context.xslt_typesMIME types to transform in addition to text/xml, default text/xml; * matches any type (0.8.29).xml_entitiesDTD file declaring character entities, used instead of the external subset of the processed XML.xml_external_entitiesAllow loading file-based external entities from the internal DTD subset, default off (1.31.3).xslt_param / xslt_string_paramStylesheet parameters as an XPath expression or a plain string (1.1.18); values may contain variables.xslt_last_modifiedKeep the Last-Modified header from the original response, default off (1.5.1).Example
Availability
Ships as a dynamic module in libnginx-mod-http-xslt-filter, installed with nginx-extras. The package drops a load_module config into /etc/nginx/modules-enabled/, so it loads on start.