Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

Invokes a template by name.

Syntax

<xsl:call-template
  name = 
QName>
</xsl:call-template>

Attributes

name

[required] Name of the template to be invoked.

Element Information

Remarks

The <xsl:call-template> enables you to invoke a named template — an <xsl:template> element — with an assigned nameattribute. If an <xsl:template> element has a nameattribute, it may, but need not, also have a matchattribute. An <xsl:call-template> element invokes a template by name; it has a required nameattribute that identifies the template to be invoked. Unlike <xsl:apply-templates>, <xsl:call-template> does not change the current node or the current node-list.

An error occurs if a style sheet contains more than one template with the same name.

An <xsl:call-template> element can contain any number of <xsl:with-param> elements. However, it cannot contain other XSLT elements.

Example

The following code example shows how the <xsl:call-template>element is used:

Copy Code
<xsl:call-template name="sample"/>
causes the following template to execute:
<xsl:template name="sample" match="//bar">
  <xsl:value-of select="."/>
</xsl:template>

See Also