xsl:template

Specifies a template rule.

Format

<xsl:template  
  [match = "pattern"] 
  [name = "qname"]  
  [mode = "mode"]  
  [priority = "priority"]> 
  template_body 
</xsl:template> 

Description

The match attribute is required except when you specify the name attribute. The pattern you specify for the match attribute identifies the source node or set of source nodes to which the template rule applies.

The optional name attribute specifies a name for the template. You can use the name of a template to invoke it with the xsl:call-template instruction. The value you specify for name must be a qualified name. If you specify a name attribute, a match attribute is not required.

The optional mode attribute prevents the template from matching nodes selected by an xsl:apply-templates instruction that specifies a different mode. The value of mode must be a qualified name or an asterisk (*). If you specify an asterisk, it means match any node.

If an xsl:apply-templates instruction contains a mode attribute, the xsl:apply-templates instruction can apply to only those xsl:template instructions that specify a mode attribute with the same value. If an xsl:apply-templates instruction does not contain a mode attribute, the xsl:apply-templates instruction can apply to only those xsl:template instructions that do not specify a mode attribute.

If you specify the match and mode attributes, they have no effect if the template is instantiated by the xsl:call-template instruction. If you specify the name attribute, you can still instantiate the template as a result of an xsl:apply-templates instruction.

If two or more templates have the same name, Stylus Studio uses the template that appears last in the stylesheet.

The template body contains literal results and XSLT instructions. The XSLT processor instantiates the template body for each node identified by pattern. This means the XSLT processor copies literal results to the result document and executes the XSLT instructions.

If there is more than one matching template rule, the XSLT processor chooses the matching template rule with the higher priority. If both have the same priority, the XSLT processor chooses the one that occurs last in the stylesheet.

For examples and additional information about templates, see Working with Templates.

Food & Beverage Services

"I'll have a burger and a side of Stylus Studio", says these top food & beverage services that use Stylus Studio in everyday operations. Come see which food & beverage services eat up the idea of having the most powerful XML IDE at their finger tips!

Support for US National Library of Medicine (NLM) Document Type Definitions

Stylus Studio provides support for editing and validating XML documents using US National Library of Medicine data models. In this tutorial, we'll provide a step-by-step overview of how to use the NLM DTD's in Stylus Studio!

XML Schema Tutorial

An XML Schema Tutorial that explores real-world XML Schema development issues, XML Schema examples and various use cases.

XML-DEV Blog

Join the XML Development discussion at XML-Dev - the hottest place to talk about XML technologies, trends, systems architecture and all the latest buzz. Bookmark this RSS and ATOM feed now!

Stylus Most Wanted

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2007 All Rights Reserved.