Invoking Templates by Name
Up to this point, we’ve always used XSLT’s <xsl:apply-templates>
element to invoke other templates. You can think of this as a
limited form of polymorphism; a single instruction is invoked a number of times, and the
XSLT processor uses each node in the node-set to determine which
<xsl:template>
to invoke. Most
of the time, this is what we want. However, sometimes we want to invoke
a particular template. XSLT allows us to do this with the <xsl:call-template>
element.
Get XSLT, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.