xslt_param

The `xslt_param` directive allows users to define parameters for XSLT transformations in NGINX.

Syntaxxslt_param name value;
Defaultnone
Contexthttp, server, location
Arguments2

Description

The xslt_param directive is specifically designed to facilitate passing parameters to XSLT stylesheets when they are processed in NGINX. This can be particularly useful for manipulating XML data dynamically during web requests. Each parameter is defined as a name-value pair, where the name corresponds to the XSLT parameter within the stylesheet, and the value represents the data to be provided for that parameter.

In practice, this directive can be used within the http, server, or location contexts, and it can accept multiple occurrences to specify different parameters for the XSLT processor. When an XSLT transformation is initiated, these parameters are automatically made available in the stylesheet, enabling customized outputs based on varying input data or conditions.

It is important to note that the parameters set by the xslt_param directive are local to the context in which they are declared. Thus, they affect any XSLT transformations occurring within the same context, allowing for flexible configuration based on specific routing or server conditions.

Config Example

location /transform {
    xslt_param param1 value1;
    xslt_param param2 value2;
    # other directives...
}

Using conflicting parameter names can lead to unexpected behavior, as later definitions will overwrite earlier ones.

Ensure that the parameter names correspond exactly to what is expected in the XSLT stylesheet to avoid runtime errors.

← Back to all directives