You can pass parameters from the JSP environment through the XMLTransform servlet bean to an XSL stylesheet. The parameters are matched by name to top-level <xsl:param> elements in the stylesheet. The XMLTransform servlet bean parameter passParam determines which parameters are passed to the stylesheet. To pass parameters, set passParams parameter to one of these scopes, listed in order of precedence:


Parameters that are passed

none (default)

No parameters are passed to the XSL stylesheet.


Parameters defined in the XMLTransform servlet bean.


URL query parameters from a GET request.


Form parameters from a POST request.


Every parameter that is in scope for XMLTransform. Local parameters have highest precedence, followed by enclosing scopes within the same JSP.

If more than one parameter exists for a given name, only the first is passed. If passParam is set to all, local parameters have the lowest precedence, up through other enclosing scopes, and eventually to the request query and post parameters.

For more information about XSL param elements, see

Sample stylesheet

The following stylesheet shows how to define top-level parameters for an XSL stylesheet; this stylesheet is used in later examples, to show how to set parameter values from URL query parameters and local JSP variables.

This simple stylesheet has two parameters, p1 and p2. The parameters are just displayed in the page, but they can be used to build other values, or tested for conditional branches.

<xsl:stylesheet version="1.0"
    <xsl:output method="xml" encoding="iso-8859-1" media-type="text/html"/>
    <xsl:param name="p1"/>
    <xsl:param name="p2" select="'p2 default'"/>
    <xsl:template match="/">
          <p>P1: <xsl:value-of select="$p1"/></p>
          <p>P2: <xsl:value-of select="$p2"/></p>

The param p1 does not have a default value, but p2 has a default text string. Note the use of single-quotes inside the select attribute. These can be omitted when the string is inside the element body:

<xsl:param name="p2">p2 default</xsl:param>

You can invoke this stylesheet in two ways.

Use URL query parameters

You can invoke a stylesheet through query parameters on a GET request URL. The JSP looks like this, with the passParams set to query scope:

<dsp:droplet name="/atg/dynamo/droplet/xml/XMLTransform">
   <dsp:param name="input" value="dummy.xml"/>
   <dsp:param name="template" value="param.xsl"/>
   <dsp:param name="passParams" value="query"/>

An appropriate URL might look like this:


Use local parameters in the XMLTransform servlet bean scope

You can also invoke a stylesheet by using local parameters in the scope of the XMLTransform servlet bean: the passParams value is set to local, and the two parameters, p1 and p2, are defined as DSP tag library <dsp:param> elements.

<dsp:droplet name="/atg/dynamo/droplet/xml/XMLTransform">
    <dsp:param name="input" value="dummy.xml"/>
    <dsp:param name="template" value="param.xsl"/>
    <dsp:param name="passParams" value="local"/>
    <dsp:param name="p1" value="563"/>
    <dsp:param name="p2" value="not default value"/>

Copyright © 1997, 2013 Oracle and/or its affiliates. All rights reserved. Legal Notices