[j-nsp] negation operator in SLAX
m4rtntns at gmail.com
Sat Jun 16 13:58:59 EDT 2018
> There is not() :
Oh, yes. I forgot the not() function. I made a small comparison
between not(), jcs:empty() and ! using five data types in SLAX:
1) False boolean value:
As expected "not( $boolean )" returns true. Also, the "jcs:empty(
$boolean )" returns true because jcs:empty() always consideres boolean
data type to be empty. Also, the "! $boolean" returns true. So for
boolean data type everything works as expected.
2) Empty string:
As expected, "not( $string )" returns true. As string is blank, then
"jcs:empty( $string )" also returns true. So does "! $string".
3) Number 0:
Again, "not( $number )", "jcs:empty( $number )" and "! $number" all
return true as expected.
4) Empty node-set:
Again, "not( $node-set )", "jcs:empty( $node-set )" and "! $node-set"
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.
So I guess it is safe to say, that "!" is the same as "not()" function?
More information about the juniper-nsp