Extension instructions calling named templates
If the name of a named template uses a namespace listed in an extension-element-prefixes
attribute, then a call on the named template may be written as an extension instruction, as an alternative
to using xsl:call-template
.
For example, if the template is declared as:
<xsl:template name="x:indent"> <xsl:param name="spaces" as="xs:integer"/> <xsl:value-of select="'
' || string-join((1 to $spaces)!' ')"/> </xsl:template>Then it may be invoked by writing:
<x:indent spaces="4"/>which (assuming the presence of extension-element-prefixes="x"
) is equivalent to:
Attributes on the extension instruction are mapped to parameters declared in the named template. The rules for passing parameters are as follows:
- If the parameter is declared with
as="xs:string"
then the attribute is interpreted as an attribute value template. - If the parameter is declared with
as="xs:boolean"
then the attribute is interpreted as an attribute value template, accepting the values "0", "false", or "no" for false, or "1", "true", or "yes" for true. - In all other cases the value of the attribute is treated as an XPath expression, which must evaluate to a value of the required type (after any conversion, using the function conversion rules).
Parameters that may be omitted (and defaulted) in an xsl:call-template
instruction
may similarly be omitted in the extension instruction.
The extension instruction must have no children other than xsl:fallback
.
There is no way to supply tunnel parameters.