Navigation
Guide That Contains This Content
[+] Expand All
[-] Collapse All

    jcs:edit-path Template

    XSLT Syntax

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

    SLAX Syntax

    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:

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

    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

    Published: 2013-03-05