On Mon, Jun 18, 2018 at 9:40 PM Phil Shafer <[email protected]> wrote: > > Martin T writes: > >Oh, yes. I forgot the not() function. I made a small comparison > >between not(), jcs:empty() and ! using five data types in SLAX: > > "!" and "not" are identical. The "!" is just syntactic sugar that > turns "! x " into "not(x)", as you can see in the code: > > https://github.com/Juniper/libslax/blob/master/libslax/slaxparser-xp.y#L164 > > >5) Empty RTF: > >"not( $rtf )" returns false, which is an expected result because even > >an empty RTF converts to true. "jcs:empty( $rtf )", to my surprise, > >returns true. According to documentation, RTF is always considered to > >not be empty. "! $rtf" returns false. > > RTFs are exactl the reason I made jcs:empty(), since it bugs me > that boolean($rtf) is true. > > http://juniper.github.io/libslax/slax-manual.html#slaxis-empty > > And "bugs" is too weak a word. Imho, RTFs are the chief source of > slax/xslt violations of the Principal of Least Astonishment. > > % cat /tmp/foo.slax > version 1.2; > > var $a := <a> { > <b> "b"; > } > > main <top> { > var $x = { copy-of $a/z; } > var $y = $a/z; > > <x> boolean($x); > <y> boolean($y); > } > % slaxproc -g -E /tmp/foo.slax > <?xml version="1.0"?> > <top> > <x>true</x> > <y>false</y> > </top> > > See also the ":=" assignment operator, which helps avoid RTFs: > > http://juniper.github.io/libslax/slax-manual.html#colon-equals > > Thanks, > Phil
Again, thank you for explaining this Phil! Martin _______________________________________________ juniper-nsp mailing list [email protected] https://puck.nether.net/mailman/listinfo/juniper-nsp

