The following sections explain each of the named templates available when you write JUNOS commit and automation scripts. The templates are organized alphabetically.
To use these templates in your scripts, you simply include <xsl:call-template name=” name” > elements and pass in any required or optional parameters. The name attribute specifies the name of the called template.
jcs:edit-path
<xsl:call-template name="jcs:edit-path">
<xsl:with-param name="dot" select="expression"/>
</xsl:call-template>
Generate an <edit-path> element suitable for inclusion in an <xnm:error> or <xnm:warning> element. By default, the location of the configuration error is passed as dot into the <jcs:edit-path> template. This location defaults to “ .” , the current position in the XML hierarchy. You can alter the default by including the select attribute of the dot parameter.
<xsl:param name="dot" select=".">—Allows you to indicate a location other than the current location in the XML hierarchy. The select attribute contains the current context “ .” as a default value. If you want to change the current context, you can include the dot parameter and include a different XPath expression in the select attribute.
See Requiring and Restricting Configuration Statements.
<xsl:call-template name="jcs:emit-change">
<xsl:with-param name="content">
...
</xsl:with-param>
<xsl:with-param name="dot" select="expression"/>
<xsl:with-param name="message">
<xsl:text>...</xsl:text>
</xsl:with-param>
<xsl:with-param name="name" select="name($dot)"/>
<xsl:with-param name="tag" select="'change'"/>
<xsl:with-param name="tag" select="'transient-change'"/>
</xsl:call-template>
Generate a <change> or <transient-change> element, which results in a persistent or transient change to the configuration.
<xsl:param name="content">—Allows you to include the content of the change, relative to dot.
<xsl:param name="dot" select=".">—Allows you to indicate a location other than the current location in the XML hierarchy. The select attribute contains the current context “ .” as a default value. If you want to change the current context, you can include the dot parameter and include a different XPath expression in the select attribute.
<xsl:param name="message">—Allows you to include a warning message to be displayed by the CLI, notifying the user that the configuration has been changed. The message parameter automatically includes the edit path, which defaults to the current location in the XML hierarchy. To change the default edit path, include the dot parameter.
<xsl:param name="name" select="name($dot)"/>—Allows you to refer to the current element or attribute. The name() XPath function returns the name of an element or attribute. The name parameter defaults to the name of the element in $dot (which in turn defaults to “ .” , the current element).
<xsl:param name="tag" select="'change'"/>—Allows you to specify the type of change to be generated. By default, the <jcs:emit-change> template generates a permanent change, as designated by the 'change' expression. To specify a transient change, you must include the tag parameter and include the 'transient-change' expression, as shown here:
<xsl:with-param name="tag" select="'transient-change'"/>
See <jcs:emit-change> Template.
See Imposing a Minimum MTU Setting.
<junos:comment>
<xsl:text>...</xsl:text>
</junos:comment>
Emit a simple comment. The template contains a <junos:comment> element. You never call the <jcs:emit-comment> template directly. Rather, you include its <junos:comment> element and the child element <xsl:text> inside a call to the <jcs:emit-change> template, a <change> element, or a <transient-change> element.
See <jcs:emit-comment> Template.
See Adding a Final then accept Term to a Firewall.
<xsl:call-template name="jcs:statement">
<xsl:with-param name="dot" select="expression"/>
</xsl:call-template>
Generate a <statement> element suitable for inclusion in an <xnm:error> or <xnm:warning> element. The parameter dot can be passed into the <jcs:statement> template if the error is not at the current position in the XML hierarchy.
<xsl:param name="dot" select=".">—Allows you to indicate a location other than the current location in the XML hierarchy. The select attribute contains the current context “ .” as a default value. If you want to change the current context, you can include the dot parameter and include a different XPath expression in the select attribute.
See Controlling a Dual Routing Engine Configuration.