0
9
<xsl:template>
<xsl:template match=”pattern”

mode=”qname”

name=”qname”

priority=”number” >

</xsl:template>

The xsl:template element is used to define a template that can be applied to a node to produce a desired output display. There must be either a match or name attribute, or both, and this determines how the template rule can be invoked.
If there is only a match attribute, then you can use the xsl:apply-template element to invoke the template rule defined by the xsl:template element. If there is only a name attribute, then you can use the xsl:call-template element to invoke the named template defined by the xsl:template element. If both attributes are present, then you may invoke the template by either procedure.
It is quite possible that more than one template can be applied to a node. The highest priority value template is always chosen. If more than one suitable template has the same highest priority value, then the XSLT processor usually chooses the one that appears last. Different templates can not have both the same name and priority values. This is an error.
The xsl:template element is always a child of either the xsl:stylesheet or xsl:transform elements.
This is not a self-closing element. The separate closing element is mandatory

match=”pattern”

The match attribute is mandatory unless the element has a name attribute, then this attribute is optional. In other words, there must be either a match or name attribute, or both. This attribute is a pattern that is used to define which nodes will have which template rules applied to them.

mode=”qname”

The optional mode attribute allows the same nodes to be processed more than once. Each time the nodes are processed, they can be displayed in a different manner.
A qname is a qualified name that is composed of an optional namespace prefix, a colon, which is only present if there is a prefix, and a mandatory XML name (for examplexsl:zipcode or zipcode). If an xsl:template element has a mode attribute, then it must also have a match attribute.
If the xsl:apply-templates element has a mode attribute, then it can only apply templates from xsl:templates elements that also have a mode attribute. Likewise, if the xsl:apply-templates element does not have a mode attribute, then it can only apply templates from xsl:templates elements that also do not have a mode attribute.
name=”qname”
The name attribute is mandatory unless the element has a match attribute, then this attribute is optional. In other words, there must be either a match or name attribute, or both. A qname is a qualified name that is composed of an optional namespace prefix, a colon which is only present if there is a prefix, and a mandatory XML name (for example, xsl:zipcode or zipcode).
If the name attribute is present, you can use the xsl:call-template element to invoke the template. To do this, the name attribute must be the same for both the xsl:template and the xsl:call-templateelements.
priority=”number”
The optional priority attribute is a real number that ranges from -9.0 to 0.0 to 9.0 that sets the priority of importance for a template. The higher the number, the higher the priority. If more than one template is suitable for a node, then the highest priority template is always chosen.
The most common default value is 0 (zero), however the exact default value that will be assigned by the XSLT processor is dependent on the pattern information contained in the match attribute.