xslt_types
The xslt_types directive defines MIME types for XSLT responses in NGINX.
Description
The xslt_types directive is used to specify the MIME types for which XSLT transformations should be applied. This directive allows you to define multiple MIME types as arguments, which NGINX will then associate with XSLT processing. When a request for a resource with one of these MIME types is received, NGINX applies the specified XSLT stylesheet to transform the content before sending it to the client.
In practice, this means you can set up your NGINX configuration to automatically transform XML documents into HTML (or other formats) based on the specified MIME types. This is particularly useful for applications that provide dynamic content rendering. Each documented type is expected to be a valid MIME type used in HTTP responses. If a client requests a resource that matches a type defined in xslt_types, the server will perform the transformation using the defined XSLT stylesheet.
Config Example
http {
xslt_types text/xml application/xml;
}Ensure that the MIME types specified are correctly set in the context where xslt_types is defined.
Be cautious about performance impacts when transforming large documents or when the XSLT processing is complex.