mode
Syntax
mode qualified-name;
Description
Indicate the mode in which a template needs to
be applied for the template to be used. If templates are applied in
the specified mode, the match
statement
is used to determine whether the template can be used with the particular
node. If more than one template matches a node in the specified mode,
the priority statement determines which template is used. The highest
priority wins. If no priority is specified explicitly, the priority
of a template is determined by the match
statement.
This statement is comparable to the mode
attribute of the <xsl:template>
element.
You can include this statement inside a SLAX match
or apply-templates
statement.
SLAX Example
match * { mode "one"; <one> .; } match * { mode "two"; <two> string-length(.); } match / { apply-templates version { mode "one"; } apply-templates version { mode "two"; } }
XSLT Equivalent
<xsl:template match="*" mode="one"> <one> <xsl:value-of select="."/> </one> </xsl:template> <xsl:template match="*" mode="two"> <two> <xsl:value-of select="string-length(.)"/> </two> </xsl:template> <xsl:template match="/"> <xsl:apply-templates select="version" mode="one"/> <xsl:apply-templates select="version" mode="two"/> </xsl:template>
Usage Examples
Release Information
Statement introduced in version 1.0 of the SLAX language.