> On 23 Nov 2015, at 13:57, Martin Bjorklund <[email protected]> wrote: > > Ladislav Lhotka <[email protected]> wrote: >> >>> On 23 Nov 2015, at 13:19, Martin Bjorklund <[email protected]> wrote: >>> >>> Hi, >>> >>> derived-from is defined as: >>> >>> boolean derived-from(node-set nodes, >>> string module-name, >>> string identity-name) >>> >>> The derived-from() function returns true if the first node in >>> document order in the argument "nodes" is a node of type >>> identityref, and its value is an identity that is derived from the >>> identity "identity-name" defined in the YANG module "module-name"; >>> otherwise it returns false. >>> >>> >>> The "first node in the node set" doesn't work well with leaf lists. I >>> suggest this change: >>> >>> NEW: >>> >>> The derived-from() function returns true if any node in >>> the argument "nodes" is a node of type >>> identityref, and its value is an identity that is derived from the >>> identity "identity-name" defined in the YANG module "module-name"; >>> otherwise it returns false. >> >> This makes sense. > > Good. > > >> In fact, other XPath functions (deref() and >> enum-value()) are also defined using "the first node in document >> order". This seems to be at odds with sec. 6.4 that says: "This means >> that XPath expressions in YANG modules SHOULD not rely on any specific >> document order." Is it OK that the result of such functions is >> undefined if the node-set argument contains multiple nodes? > > I think so. These functions are intended for single leafs (what is > the enum value of a leaf-list?). The alternative would be to say that > it is an error if the node set contains more than one node, but XPath > functions rarely returns errors.
I don't think it should be an error but it might be useful to explicitly state that the result of deref() and enum-value() is undefined if the node-set involves multiple nodes, with reference to sec. 6.4. Lada > > > /martin -- Ladislav Lhotka, CZ.NIC Labs PGP Key ID: E74E8C0C _______________________________________________ netmod mailing list [email protected] https://www.ietf.org/mailman/listinfo/netmod
