Set parameters to be passed to the initial template. These are used
whether the transformation is invoked by applying templates to an initial source item,
or by invoking a named template. The parameters in question are the xsl:param elements
appearing as children of the xsl:template element.
The parameters are supplied in the form of a map; the key is a QName which must
match the name of the parameter; the associated value is an XdmValue containing the
value to be used for the parameter. If the initial template defines any required
parameters, the map must include a corresponding value. If the initial template defines
any parameters that are not present in the map, the default value is used. If the map
contains any parameters that are not defined in the initial template, these values
are silently ignored.
The supplied values are converted to the required type using the function conversion
rules. If conversion is not possible, a run-time error occurs (not now, but later, when
the transformation is actually run).
The XsltTransformer
retains a reference to the supplied map, so parameters can be added or
changed until the point where the transformation is run.
The XSLT 3.0 specification makes provision for supplying parameters to the initial
template, as well as global stylesheet parameters. Although there is no similar provision
in the XSLT 1.0 or 2.0 specifications, this method works for all stylesheets, regardless whether
XSLT 3.0 is enabled or not.