Lada,
For example:
Module a {
namespace "http://example.com/a";
typedef instance-ref {
type leafref {
path "instances/instance/name";
}
}
container instances {
list instance {
key name;
leaf name {
type string;
}
....
}
}
}
module b import module a, and use the instance-ref defined by module a
module b {
namespace "http://example.com/b";
import a {
prefix a;
}
list interface {
key name;
leaf name {
...
}
leaf instance {
type a:instance-ref;
}
}
}
According section 6.4.1, the namespace of names without prefix belong to the
same namespace where the typedefs are used. So,
The path instances/instance/name,the namespace of these 3 names should be
http://example.com/b, but module b have no these definitions. I think it's
unreasonable.
The meaning of author of module a should be reference the instance name defined
in module a, not module b.
So, IMO, the namespace of un-prefixed names in absolute location XPATH should
be the same with the namespace of the module where they are defined. The
context node of absolute path should be the module where they are defined.
-----邮件原件-----
发件人: Ladislav Lhotka [mailto:[email protected]]
发送时间: 2023年1月11日 15:42
收件人: Fengchong (frank) <[email protected]>; [email protected]
主题: Re: [netmod] question about name without prefix in XPath expression
Dne 11. 01. 23 v 4:16 Fengchong (frank) napsal(a):
> Hi all,
>
> In RFC 7950 section 6.4.1:
>
> o Names without a namespace prefix belong to the same namespace
> as
>
> the identifier of the current node. Inside a grouping, that
>
> namespace is affected by where the grouping is used (see
>
> Section 7.13 <https://www.rfc-editor.org/rfc/rfc7950#section-7.13>).
> Inside a typedef, that namespace is affected by
>
> where the typedef is referenced. If a typedef is defined and
>
> referenced within a grouping, the namespace is affected by
> where
>
> the grouping is used (see Section 7.13
> <https://www.rfc-editor.org/rfc/rfc7950#section-7.13>).
>
> and section 5.4:
>
> Grouping, type, and identity names are resolved in the context in
>
> which they are defined, rather than the context in which they are
>
> used. Users of groupings, typedefs, and identities are not
> required
>
> to import modules or include submodules to satisfy all references
>
> made by the original definition. This behaves like static scoping
> in
>
> a conventional programming language.
>
> I think these two section have some conflicts. If groupings and
> typedefs are resolved in the context where they are defined, why names
> without prefix belongs to the namespace where they are used?
I don't think there is any conflict. The quoted text from 5.4 can actually be
expanded as "Grouping names, type names and identity names are resolved ..."
I may be missing something because I also don't see the XPath expression part
that you have in the subject.
Lada
>
> The authors who defined the groupings and typedefs don’t know where
> these definitions are used, they only know the place where these
> definitions are defined.
>
>
> _______________________________________________
> netmod mailing list
> [email protected]
> https://www.ietf.org/mailman/listinfo/netmod
--
Ladislav Lhotka, CZ.NIC
PGP Key ID: 0xB8F92B08A9F76C67
_______________________________________________
netmod mailing list
[email protected]
https://www.ietf.org/mailman/listinfo/netmod