Subject: [netmod] default namespace in XPath

From: Ladislav Lhotka <[email-masked]>
Date: Wed, 07 Mar 2018 10:11:32 +0100

Hi,

sec. 6.4.1 in RFC 7950 says in the second bullet item:

    Names without a namespace prefix belong to the same namespace as
    the identifier of the current node.

It is unclear what "current node" means:

1. Is it the context node of the XPath expression, or

2. is it the schema node corresponding to the parent statement of the must/when
statement?

For example:

module example-4-a {
  ...
  container bag {
    ...
  }
}

module example-4-b {
  ...
  import example-4-a {
    prefix "ex4a";
  }

  augment "/ex4a:bag" {
    when "/quux = 0";
    ...
    }
  }
  ...
}

What is the namespace of "quux" in the when expression? Is it "example-4-a"
(option 1 above) or "example-4-b" (option 2)?

Thanks, Lada

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

---

From: Michal Vaško <[email-masked]>
Date: Wed, 07 Mar 2018 10:18:38 +0100

Hello,
we have implemented it as option 1 based on the "current()" function definition (RFC 7950 sec. 10.1.1):

The current() function takes no input parameters and returns a node
   set with the initial context node as its only member.

If this was not intended and actually option 2 is correct, the "current()" function should probably be renamed or return a different node to be consistent and not misleading.

Regards,
Michal

On Wednesday, March 7, 2018 10:11 CET, Ladislav Lhotka <[email-masked]> wrote: 
 
> _______________________________________________
> netmod mailing list
> [email-masked]
> https://www.ietf.org/mailman/listinfo/netmod

---

From: Ladislav Lhotka <[email-masked]>
Date: Wed, 07 Mar 2018 12:34:12 +0100

Hi Michal,

On Wed, 2018-03-07 at 10:18 +0100, Michal Vaško wrote:
> Hello,
> we have implemented it as option 1 based on the "current()" function 

Right, I have the same in my implementation. It is however counter-intuitive in
cases like my example because unprefixed names normally receive the namespace of
the module where they appear (I made a mistake myself:-).

> definition (RFC 7950 sec. 10.1.1):
> 
> If this was not intended and actually option 2 is correct, the "current()"
> function should probably be renamed or return a different node to be
> consistent and not misleading.

IMO the current() function should stay, but the text in sec. 6.4.1 has to be
changed:

OLD

NEW
  Names without a namespace prefix belong to the same namespace as
  the identifier of the context node.

If there are no objections, I will file an erratum.

Lada

---

From: Martin Bjorklund <[email-masked]>
Date: Wed, 07 Mar 2018 14:06:20 +0100 (CET)

> (option 1 above) or "example-4-b" (option 2)?

Just like with all other unprefixed items (except in a
grouping/typedef), it is supposed to default to the prefix of the
module where it is defined (lexical scope).  So it is supposed to be
"example-4-b".  I agree that the term "current node" is misleading.

/martin

---

From: Ladislav Lhotka <[email-masked]>
Date: Wed, 07 Mar 2018 14:30:50 +0100

> "example-4-b".  I agree that the term "current node" is misleading.

But then you cannot refer to XPath 2.0 as being the model for this default
namespace concept because in-scope namespaces defined in XPath 2.0 are bound to
element (XPath) nodes.

Lada