Name

<xsl:template>

Synopsis

The <xsl:template> top-level element is the key to all of XSLT. The match attribute contains a pattern against which nodes are compared as they’re processed. If the pattern is the best match for a node, then the contents are instantiated and inserted into the output tree. This element uses the following attributes:

match

A pattern against which nodes can be compared. This pattern is a location path that uses the abbreviated XPath syntax. Only the child and attribute axes may be used. The // separator may also be used.

priority

A number. In the event that more than one template matches a given node, the one that most specifically matches the node is chosen. If several templates match a node with the same level of specificity, then the template with the highest value of the priority attribute is instantiated. If several matching templates have equal priorities, then the last one in the style sheet is chosen (the processor may also throw an error in this situation).

name

A name by which this template can be invoked from an <xsl:call-template> element rather than by node matching.

mode

The template’s mode. If the <xsl:template> element has a mode, then this template is only matched when the mode attribute of the calling instruction matches the value of this mode attribute.

<xsl:template
   [match = "pattern"]
   [priority = "number"]
   [name = "name"]
   [mode = "mode"]>
   ...
</xsl:template>

Get Webmaster in a Nutshell, Third 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.