[j-nsp] understand "version" and "ns"(namespace) statements in SLAX scripts

Martin T m4rtntns at gmail.com
Tue Dec 22 04:50:23 EST 2015


Hi,

if I look the SLAX script examples in Juniper web-site, then almost
all of those examples have "version" and multiple "ns" statements. For
example:

version 1.0;
ns junos = "http://xml.juniper.net/junos/*/junos";
ns xnm = "http://xml.juniper.net/xnm/1.1/xnm";
ns jcs = "http://xml.juniper.net/junos/commit-scripts/1.0";
ns ext = "http://xmlsoft.org/XSLT/namespace";


While I understand the idea of namespace in XML, then what is the
point of those statements in SLAX scripts? In addition, how does the
"version" statement work? Looks like this is (for some reason)
mandatory as let's say that I have a following very simple script:

$ cat hello_world.slax
version 1.0;

match / {
  <op-script-results> {
    <output> "Hello World!";
  }
}
$

..and I remove the "version 1.0;" line, then the script does not operate:

> op hello_world
error: /var/db/scripts/op/hello_world.slax:1: missing 'version'
statement; 'match' is not legal
error: /var/db/scripts/op/hello_world.slax: 1 error detected during parsing
error: error reading stylesheet: hello_world.slax

>



thanks,
Martin


More information about the juniper-nsp mailing list