Hi Lada,

Look at below examples, 

module ietf-test {
   namespace "urn:ietf:params:xml:ns:yang:ietf-test";
   prefix itest;
        
        import ietf-interfaces {
    prefix if;
    }

        augment "/if:interfaces/if:interface"{
          list A{
           key "a";
           leaf a{
            type string;
           }
          }
         }
         grouping B{
          leaf b{
           type leafref{
            path "/if:interfaces/if:interface/A/a";
           }
          }
         }
         
}

module ietf-foo {
     namespace "urn:ietf:params:xml:ns:yang:ietf-foo";
     prefix foo;
        
        import ietf-test{
        prefix itest;
        }
                 
    container C{
         uses itest:B;
        }
         
}

when I run the "ietf-foo" module, the "current module's prefix" is "foo" and I 
receive a error report: .\ietf-test.yang:32: error: ietf-foo:A in the path for 
b at ietf-foo.yang:23 (at
 .\ietf-test.yang:30) is not found.
I believe it means, the path "/if:interfaces/if:interface/A/a" in module 
"ietf-foo" is equal to "/if:interfaces/if:interface/foo:A/foo:a"

-Michael

-----邮件原件-----
发件人: Ladislav Lhotka [mailto:[email protected]] 
发送时间: 2016年11月24日 17:40
收件人: wangzitao
抄送: NETMOD WG
主题: Re: [netmod] default namespace in XPath


> On 24 Nov 2016, at 10:33, wangzitao <[email protected]> wrote:
> 
> Hi Lada,
> 
> In my understanding, it means to equal to current module's prefix.

No, it is not, because if the expression appears inside a grouping, then the 
next sentence of the same bullet says "that namespace is affected by where the 
grouping is used".

Lada

> For example: 
> 
> module ietf-foo {
>     namespace "urn:ietf:params:xml:ns:yang:ietf-foo";
>     prefix foo;
>       
>       import ietf-interfaces {
>    prefix if;
>    }
>       
>    .....
> 
>        augment "/if:interfaces/if:interface"{
>         list A{
>          key "a";
>          leaf a{
>           type string;
>          }
>         }
>        }
>        
>        list B{
>         key "b";
>         leaf b{
>          type leafref{
>           path "/if:interfaces/if:interface/A/a";
>          }
>         }
>        }
>        
> }
> 
> In above example, the path "/if:interfaces/if:interface/A/a" equal to 
> "/if:interfaces/if:interface/foo:A/foo:a".
> 
> BR!
> -Michael
> 
> -----邮件原件-----
> 发件人: netmod [mailto:[email protected]] 代表 Ladislav Lhotka
> 发送时间: 2016年11月24日 17:14
> 收件人: NETMOD WG
> 主题: [netmod] default namespace in XPath
> 
> Hi,
> 
> second bullet in sec. 6.4.1 of RFC 7950 says:
> 
>    Names without a namespace prefix belong to the same namespace as the 
> identifier of the current node.
> 
> But what is the current node? Is it the same as the result of the current() 
> function or, if we have
> 
>    "/x:foo/bar"
> 
> is the namespace of "bar" the one corresponding to prefix "x"?
> 
> Lada
> 
> --
> Ladislav Lhotka, CZ.NIC Labs
> PGP Key ID: E74E8C0C
> 
> 
> 
> 
> _______________________________________________
> netmod mailing list
> [email protected]
> https://www.ietf.org/mailman/listinfo/netmod

--
Ladislav Lhotka, CZ.NIC Labs
PGP Key ID: E74E8C0C




_______________________________________________
netmod mailing list
[email protected]
https://www.ietf.org/mailman/listinfo/netmod

Reply via email to