[Contents] [Prev] [Next] [Index] [Report an Error]

JUNOS Named Templates

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

Syntax

<xsl:call-template name="jcs:edit-path">
    <xsl:with-param name="dot" select="expression"/>
</xsl:call-template>

Description

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.

Usage Guidelines

See <jcs:edit-path> Template.

See Requiring and Restricting Configuration Statements.

Related Topics

xsl:param, xsl:with-param

jcs:emit-change

Syntax

<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>

Description

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'"/>

Usage Guidelines

See <jcs:emit-change> Template.

See Imposing a Minimum MTU Setting.

Related Topics

xsl:param, xsl:with-param

jcs:emit-comment

Syntax

<junos:comment>
    <xsl:text>...</xsl:text>
</junos:comment>

Description

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.

Usage Guidelines

See <jcs:emit-comment> Template.

See Adding a Final then accept Term to a Firewall.

Related Topics

 jcs:emit-change

jcs:statement

Syntax

<xsl:call-template name="jcs:statement">
    <xsl:with-param name="dot" select="expression"/>
</xsl:call-template>

Description

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.

Usage Guidelines

See <jcs:statement> Template.

See Controlling a Dual Routing Engine Configuration.

Related Topics

xsl:param, xsl:with-param


[Contents] [Prev] [Next] [Index] [Report an Error]