Junos Named Templates in the jcs Namespace

Named templates are provided in the junos.xsl import file to make scripting tasks easier in commit, op, and event scripts. Named templates have the jcs: prefix to indicate they belong to the jcs: namespace. The templates use the jcs: prefix to avoid conflicting with user-defined templates of the same name in a script.

When you use named templates in a script, you must map to the jcs namespace in your style sheet declaration by including the xmlns:jcs attribute in the opening <xsl:stylesheet> tag element. You must also include the <xsl:import/> tag element to import the junos.xsl file. Both of these steps are shown in the following examples:

XSLT Syntax

<?xml version=”1.0”?>
<xsl:stylesheet version=”1.0”
             xmlns:jcs="http://xml.juniper.net/junos/commit-scripts/1.0">
    <xsl:import href="../import/junos.xsl"/>
    ...
</xsl: stylesheet>

SLAX Syntax

version 1.0;
ns jcs = "http://xml.juniper.net/junos/commit-scripts/1.0";
import "../import/junos.xsl";

You then include an <xsl:call-template name="name"> element in the script to reference each named template, passing in any required or optional parameters.

For more information about attributes and tag elements to include in your scripts, see Required Boilerplate for Commit Scripts, Required Boilerplate for Op Scripts, and Required Boilerplate for Event Scripts.

The templates are discussed in more detail in the following sections: