In the SLAX language, a variable is a reference to an assigned value. The variable name is used within the script, and the script engine substitutes the value in its place when it executes the script. SLAX variables are immutable; they cannot be changed. This might seem strange to those who are accustomed to other programming languages, but in SLAX variables always refer to the value to which they were first assigned.
  1. The jcs, xnm, and junos namespaces are reserved. Do not use any of these namespaces when creating variables, parameters, elements, or templates.
  2. Do not start any names with "junos" or "slax". These names are reserved for future use.
While the following serve as guidelines, they are also best practices that let your scripts conform to Junos configuration naming standards as well as to official Junos scripts.
  1. Write variables, parameters, elements, and templates entirely in lowercase.
  2. Separate multiple words with a dash ( - ), for example: gig-interface

version 1.0;

ns junos = "*/junos";
ns xnm = "";
ns jcs = "";

import "../import/junos.xsl";

/* This is a Global Variable */
var $first-string = "Hello World!";

match / {
    <op-script-results> {
        /* This is a variable with template scope */
        var $second-string = "Goodbye World!";
        /* Output both variables to the console */
        <output> $first-string;
        <output> $second-string;