On 31. 12. 21 16:38, Andy Bierman wrote:


On Fri, Dec 31, 2021 at 2:01 AM Ladislav Lhotka <ladislav.lho...@nic.cz <mailto:ladislav.lho...@nic.cz>> wrote:

    Carsten Bormann <c...@tzi.org <mailto:c...@tzi.org>> writes:

     > On 2021-12-30, at 13:29, tom petch <ie...@btconnect.com
    <mailto:ie...@btconnect.com>> wrote:
     >>
     >>       when "../../../../../../nw:network-types/tet:te-topology/“
     >
     > I’m probably showing my ignorance about YANG again, but what is
    the reason this is not phrased as
     >
     >       when "./ancestor::nw:network-types/tet:te-topology/“

    Yes, this would work, with a minor correction:

         when "./ancestor::node()/nw:network-types/tet:te-topology"



This is not equivalent to the original expression.

It is not equivalent but will work fine in this case because there is only one ancestor having a 'nw:network-types' child. Unlike the absolute path, one is confined to the same 'nw:network' entry here.

It means slightly more work for an XPath processor but is IMO considerably more readable and less error-prone.

Lada


The ".."  location step stands for parent::node().
The node match has to occur at a specific ancestor level.

But "ancestor::node()" will match any ancestor node.



Andy


    because 'nw:network-types' isn't an ancestor of the context node.
    Also, the initial './' isn't actually needed, hence

         when "ancestor::node()/nw:network-types/tet:te-topology"

    Lada

     >
     > ?
     >
     > Grüße, Carsten
     >
     > _______________________________________________
     > netmod mailing list
     > netmod@ietf.org <mailto:netmod@ietf.org>
     > https://www.ietf.org/mailman/listinfo/netmod
    <https://www.ietf.org/mailman/listinfo/netmod>

-- Ladislav Lhotka
    Head, CZ.NIC Labs
    PGP Key ID: 0xB8F92B08A9F76C67

    _______________________________________________
    netmod mailing list
    netmod@ietf.org <mailto:netmod@ietf.org>
    https://www.ietf.org/mailman/listinfo/netmod
    <https://www.ietf.org/mailman/listinfo/netmod>


_______________________________________________
netmod mailing list
netmod@ietf.org
https://www.ietf.org/mailman/listinfo/netmod

--
Ladislav Lhotka
Head, CZ.NIC Labs
PGP Key ID: 0xB8F92B08A9F76C67

_______________________________________________
netmod mailing list
netmod@ietf.org
https://www.ietf.org/mailman/listinfo/netmod

Reply via email to