Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

Announcement: Try the Ask AI chatbot for answers to your technical questions about Juniper products and solutions.

close
header-navigation
keyboard_arrow_up
close
keyboard_arrow_left
Automation Scripting User Guide
Table of Contents Expand all
list Table of Contents
file_download PDF
{ "lLangCode": "en", "lName": "English", "lCountryCode": "us", "transcode": "en_US" }
English
keyboard_arrow_right

jcs:statement Template

date_range 13-Feb-21

XSLT Syntax

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

SLAX Syntax

content_copy zoom_out_map
call jcs:statement($dot=expression);

Description

Generate a <statement> element suitable for inclusion in an <xnm:error> or <xnm:warning> element. This location defaults to “ . ”, the current position in the XML hierarchy. If the error is not at the current position in the XML hierarchy, you can alter the default when you call the template by including a valid XPath expression either for the dot parameter in SLAX scripts or for the select attribute of the dot parameter in XSLT scripts.

Parameters

dot

XPath expression specifying the hierarchy level. The default location is the position in the XML hierarchy that the script is currently evaluating. You can alter the default when you call the template by including a valid XPath expression either for the dot parameter in SLAX scripts or for the select attribute of the dot parameter in XSLT scripts.

Usage Examples

The following example demonstrates how to call the jcs:statement template in a commit script:

content_copy zoom_out_map
<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:

content_copy zoom_out_map
[edit]
user@host# commit
content_copy zoom_out_map
[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: Impose a Minimum MTU Setting.

footer-navigation