PI Parameters

PI Parameters

Overview

XSLT supports the concept of passing parameters to a stylesheet when executing it. This has been possible for a while when using the XSLTProcessor in JavaScript. However when using an <?xml-stylesheet?> processing instruction (PI) there used to be no way to provide parameters.

To solve this two new PIs are implemented in Firefox 2 (see Supported versions below for details), <?xslt-param?> and <?xslt-param-namespace?>. Both PIs can contain "pseudo attributes" the same way that the xml-stylesheet PI does.

The following document passes the two parameters "color" and "size" to the stylesheet "style.xsl".

<?xslt-param name="color" value="blue"?>
<?xslt-par