Supported Platforms
Related Documentation
- ACX, EX, M, MX, PTX, SRX, T Series
- XSLT Templates Overview
- xsl:apply-templates
- xsl:call-template
- xsl:param
- xsl:variable
- xsl:with-param
- ACX, EX, M, MX, SRX, T Series
- XSLT Parameters Overview
xsl:template
Syntax
<xsl:template match="pattern" mode="qualified-name" name="qualified-name priority="integer">
<xsl:param name="qualified-name" select="expression">
...
</xsl:param>
...
</xsl:stylesheet>
Description
Declare a template that contains rules to apply when a specified node is matched. The match attribute associates the template with an XML element. The match attribute can also be used to define a template for a whole branch of an XML document. For example, match="/" matches the root element of the document. Although the match and name attributes are optional, one of the two attributes must be included in the template definition.
When templates are applied to a node set using the <xsl:apply-templates> instruction, they might be applied in a particular mode; the mode attribute in the <xsl:template> instruction indicates the mode in which a template needs to be applied for the template to be used. If templates are applied in the specified mode, the match attribute is used to determine whether the template can be used with the particular node. If more than one template matches a node in the specified mode, the priority attribute determines which template is used. The highest priority wins. If no priority is specified explicitly, the priority of a template is determined by the match attribute.
You can pass template parameters using the <xsl:with-param> element. To receive a parameter, the template must contain an <xsl:param> element that declares a parameter of that name. These parameters are listed before the body of the template, which is used to process the node and create a result.
Attributes
match | — | (Optional) XPath expression specifying the nodes to which to apply the template. If this attribute is omitted, the name attribute must be included. |
mode | — | (Optional) Indicate the mode in which a template needs to be applied for the template to be used. |
name | — | (Optional) Specify a name for the template. Named templates can be explicitly called with the <xsl:call-template> element. If the name attribute is omitted, the match attribute must be included. |
priority | — | (Optional) Specify a numeric priority for the template. |
Usage Examples
- Example: Adding a Final then accept Term to a Firewall
- Example: Adding T1 Interfaces to a RIP Group
- Example: Automatically Configuring Logical Interfaces and IP Addresses
- Example: Customizing Output of the show interfaces terse Command Using an Op Script
- Example: Requiring and Restricting Configuration Statements
Related Documentation
- ACX, EX, M, MX, PTX, SRX, T Series
- XSLT Templates Overview
- xsl:apply-templates
- xsl:call-template
- xsl:param
- xsl:variable
- xsl:with-param
- ACX, EX, M, MX, SRX, T Series
- XSLT Parameters Overview
Published: 2013-03-05
Supported Platforms
Related Documentation
- ACX, EX, M, MX, PTX, SRX, T Series
- XSLT Templates Overview
- xsl:apply-templates
- xsl:call-template
- xsl:param
- xsl:variable
- xsl:with-param
- ACX, EX, M, MX, SRX, T Series
- XSLT Parameters Overview