jcs:statement Template

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.

Parameters

<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

The following example demonstrates how to call this template in a commit script:

<xnm:error>
    <xsl:call-template name="jcs:edit-path"/>
    <xsl:call-template name="jcs:statement">
        <xsl:with-param name="dot" select="mtu"/>
    </xsl:call-template>
    <message>
        <xsl:text>SONET interfaces must have a minimum MTU of </xsl:text>
        <xsl:value-of select="$min-mtu"/>
        <xsl:text>.</xsl:text>
    </message>
</xnm:error>

When you commit a configuration that includes a SONET/SDH interface with a maximum transmission unit (MTU) setting less than a specified minimum, the <xnm:error> element results in the following CLI output:

[edit]

user@host# commit
[edit interfaces interface so-1/2/3]
    'mtu 576;'  # mtu statement generated by the <jcs:statement> template
    SONET interfaces must have a minimum MTU of 2048.
error: 1 error reported by commit scripts
error: commit script failure

The test of the MTU setting is not performed in the <xnm:error> element. For the full example, see Example: Imposing a Minimum MTU Setting.

Related Topics