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:edit-path Template

date_range 13-Feb-21

XSLT Syntax

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

SLAX Syntax

content_copy zoom_out_map
call jcs:edit-path($dot=expression);

Description

Generate an <edit-path> element suitable for inclusion in an <xnm:error> or <xnm:warning> element. This template converts a location in the configuration hierarchy into the standard text representation that you would see in the Junos OS configuration mode banner. By default, the location of the configuration error is passed into the jcs:edit-path template as the value of dot. This location defaults to “ . ”, the current position in the XML hierarchy. You can alter the default by including a valid XPath expression for the dot parameter when you call the template.

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:edit-path template in a commit script and set the context to the [edit chassis] hierarchy level:

content_copy zoom_out_map
<xsl:if test="not(chassis/source-route)">
    <xnm:warning>
        <xsl:call-template name="jcs:edit-path">
            <xsl:with-param name="dot" select="chassis"/>
        </xsl:call-template>
        <message>IP source-route processing is not enabled.</message>
    </xnm:warning>
</xsl:if>

When you commit a configuration that does not enable IP source routing, the code generates an <xnm:warning> element, which results in the following command-line interface (CLI) output:

content_copy zoom_out_map
user@host# commit
[edit chassis] # The hierarchy level is generated by the jcs:edit-path template.
    warning: IP source-route processing is not enabled.
commit complete
footer-navigation