[j-nsp] understanding the root container element of node-set in SLAX

Martin T m4rtntns at gmail.com
Fri Feb 2 07:13:21 EST 2018


Hi!

Let's say that I define a simple node-set in op script:

var $results := {
    <abc a="12" b="34" c="56"> {
        <klm k="78"> {
            <name n="9"> "foo";
        }
    }
}

When I print the $results variable in debugger, then I can see that
its type is "[node-set] (1) rtf-doc".:

(sdb) print $results
[node-set] (1) rtf-doc
<abc a="12" b="34" c="56">
  <klm k="78">
    <name n="9">foo</name>
  </klm>
</abc>
(sdb)

This should mean that node-set is encapsulated in RTF. I know that I
can access the node-set with $results/abc, but what is confusing for
me is that when I do:

for-each ($results/abc) {
    <output> name(.);
}

..then "abc" is printed while I would expect "klm". Is this RTF
container-element also named "abc"? However, for example,
"$results/abc/abc" does not match anything.


thanks,
Martin


More information about the juniper-nsp mailing list