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

Tom Storey tom at snnap.net
Wed Dec 23 22:07:43 EST 2015


According to libslax documentation, which is also the base of Junipers
implementation, the version statement indicates the minimum SLAX
language version required to run your script.

You can find libslax documentation here:
http://www.libslax.org/the-slax-language

On 22 December 2015 at 20:50, Martin T <m4rtntns at gmail.com> wrote:
> 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
> _______________________________________________
> juniper-nsp mailing list juniper-nsp at puck.nether.net
> https://puck.nether.net/mailman/listinfo/juniper-nsp


More information about the juniper-nsp mailing list