[j-nsp] predicates in if statement expression in SLAX
Martin T
m4rtntns at gmail.com
Thu Mar 15 04:56:31 EDT 2018
Phil,
thank you for confirming this!
Martin
On Wed, Mar 14, 2018 at 10:52 PM, Phil Shafer <phil at juniper.net> wrote:
> Martin T writes:
>>Is there a difference between following two if statement expressions:
>>if ($node-set/foo/bar == "klm") {
>>..and:
>>if ($node-set[foo/bar == "klm"]) {
>
> If there is, I'm missing it.
>
> The first expression selects a set of "bar" nodes and then returns
> true if any of them are "klm". The second selects a set of first-level
> nodes under $node-set named "foo" with a "bar" child that equals
> "klm". While the two expressions build different types (boolean
> .vs. node-set), the resulting booleans should be equivalent: either
> way the result will be false if $node-set contains no "foo" nodes
> which contain "bar" children that equal "klm".
>
> Thanks,
> Phil
More information about the juniper-nsp
mailing list