Name
<xsl:template>
Defines an output template. Templates that begin
<xsl:template match="x" define a
transformation for a given element. Templates that begin <xsl:template name="x" define a set of
output elements that are processed whenever the template is invoked by
name. All <xsl:template> elements must have either
the match or the name attribute defined. Although not common,
it is also possible to create <xsl:template> elements that have both
a match and a name.
Category
Top-level element.
Required Attributes
None; however, an <xsl:template> must contain a match attribute, a name attribute, or both.
Optional Attributes
matchA pattern that defines the elements for which this template should be invoked. For example,
<xsl:template match="xyz">defines a template for processing<xyz>elements.nameAn attribute that names this template. Named templates are invoked with the
<xsl:call-template>element.modeAn attribute that defines a mode for this template. A mode is a convenient syntax that allows you to write specific templates for specific purposes. For example, we could write an
<xsl:template>withmode="toc"to process a node for the table of contents of a document, and we could write other<xsl:template>s withmode="print",mode="online",mode="index", etc. to process the same information for different purposes.[2.0] In XSLT 2.0, the
modeattribute can use the value#defaultto indicate that this template applies to the default mode, or use#allto indicate that this template applies ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access