Martin Bjorklund <[email protected]> wrote: > Hi, > > "Sterne, Jason (Nokia - CA/Ottawa)" <[email protected]> wrote: > > Hi all, > > > > I'm pretty sure that this xpath (e.g. in a must statement) isn't > > correct: > > > > (A) ../container-a/list-b[name=*]/some-leaf > > > > and should just be this instead: > > > > (B) ../container-a/list-b/some-leaf > > Assuming all list entries has a 'name', yes, it is the same. > > > Or is the * an allowable wildcard for a key value in a predicate ? > > "*" is syntactically legal, but is not a wildcard on all values of the > node; it is a wildcard for all nodes. > > So if all list entries has a name, A will evaluate to the same nodeset > as B, since "name = *" is a node-set comparison, and the node "name" > will be present in the node set from "*" (node set comparisons are not > always intuitive; read the spec for all details ;-) > > > I also had a question about whether the following "must" correctly > > checks that at least one entry exists in a-list. > > > > container c1 { > > leaf foo { > > must "a-list"; > > type uint16; > > } > > list a-list { > > key "entry"; > > leaf entry { > > type uint16; > > } > > leaf another-entry { > > type uint32; > > } > > } > > } > > > > I think I could also replace that must with the following: > > must "count(a-list) > 1"; > > but does must "a-list"; achieve the same thing ? > > Yes, but if the list is big, the simple "a-list" may be more > efficient, since "count()" will actually count all instances > (modulo existance of optimizations in the evaluator).
Whoops, I was too quick; see Alex's email for a better answer! /martin _______________________________________________ netmod mailing list [email protected] https://www.ietf.org/mailman/listinfo/netmod
