On Wed, Sep 25, 2019 at 8:37 AM Sterne, Jason (Nokia - CA/Ottawa) <
[email protected]> wrote:
> Hi all,
>
>
>
> I saw some recent questions about 'when' statements. I had another one
> related to evaluating 'when' statements that involve leafs that don't
> currently have a value at all.
>
>
>
> leaf foo {
>
> type enumeration {
>
> enum val1;
>
> enum val2;
>
> }
>
> }
>
>
>
> leaf bar {
>
> when "../foo != 'val2'";
>
> type uint8;
>
> }
>
>
>
> Notice that foo does not have a default statement. So if no manager has
> set leaf foo, it doesn't exist in the config.
>
>
>
> In that case, does the "when" statement evaluate to 'true' (i.e. leaf bar
> is allowed to have a value) ?
>
>
>
no
> i.e. assuming leaf foo is not set at all, is this accepted?
>
> <bar>23</bar>
>
>
>
> Or is there something special here because of the non-existence of leaf
> foo?
>
>
>
correct.
An empty node-set does not always convert to am empty string.
So easy to tell XPath to do the wrong thing...
when "../foo != 'val2'";
is not equivalent to
when "string(../foo) != 'val2'";
If one object to be compared is a node-set and the other is a string, then
the comparison will be true if and only if there is a node in the node-set
such that the result of performing the comparison on the string-value
<https://www.w3.org/TR/1999/REC-xpath-19991116/#dt-string-value> of the
node and the other string is true.
Andy
If the "when" evaluates to 'false', then does the following "when" evaluate
> differently than the one above?
>
> when "not(../foo = 'val2')";
>
>
>
> Jason
> _______________________________________________
> netmod mailing list
> [email protected]
> https://www.ietf.org/mailman/listinfo/netmod
>
_______________________________________________
netmod mailing list
[email protected]
https://www.ietf.org/mailman/listinfo/netmod