Subject: [netmod] must-stmt and XPath

From: Ladislav Lhotka <[email-masked]>
Date: Thu, 17 Jul 2008 13:56:35 +0200

Hi,

YANG draft says that the argument to must-stmt is an XPath expression.
However, XPath specification considers all XML element names without a
namespace prefix to have no namespace, even if the instance document
declares a default namespace for them.

Presumably, the reason for making the must-stmt argument an XPath is to
be able to take this XPath expression and use it directly in XSLT
scripts. However, this is not possible since YANG data model
vocabularies have an assigned namespace and so any XPath expression with
unprefixed node names won't match anything if used with standard XML
software.

The straighforward solution would be to require namespace prefix with
all node names in the XPath expression. This is awkward but the only
alternative I can see for using the XPath expressions for validation is
to parse the XPath expression and add the prefixes automatically.

Lada

-- 
Ladislav Lhotka, CESNET
PGP Key ID: E74E8C0C

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

---

From: Andy Bierman <[email-masked]>
Date: Sun, 20 Jul 2008 08:09:35 -0700

> unprefixed node names won't match anything if used with standard XML

The main reason for using XPath is to provide naming and filtering
in the NETCONF protocol.

I do not know the XPath spec well enough (yet), but YANG should
obviously use it in a compliant way.  If you are correct, then
treating identifiers without prefixes as "local to the current module
and all its submodules", is not compliant.  They are not in the local
module namespace, but rather the special empty namespace "".

> to parse the XPath expression and add the prefixes automatically.

A tool that blindly pulls Xpath expressions from
YANG modules for XSLT consumption does not seem that likely,
so requiring a YANG-aware tool (like pyang) to add in
the default prefix as needed seems OK.

But I don't mind if prefixes were mandatory in XPath expressions.

Then the spec should be clarified that the 'no-prefix ==
local module' rule applies only to identifier-str.

> Lada

Andy

---

From: Martin Bjorklund <[email-masked]>
Date: Sun, 20 Jul 2008 22:15:40 +0200 (CEST)

Hi,

> declares a default namespace for them.

Right.

> scripts.

The main reason was rather to reuse a suitable technology instead of
inventing a new one, and XPath is already used in NETCONF, so people
probably know it already.

> However, this is not possible since YANG data model
> all node names in the XPath expression. This is awkward

... which is why we tried to avoid it.

> but the only

Is this good enough for the implementations that use std software
as-is?  (Are there any?)

Another alternative is to use XPath 1.1 which supports the concept of
a default namespace.  But I'd rather see that NETCONF and YANG use the
same version of XPath.

/martin

---

From: Ladislav Lhotka <[email-masked]>
Date: Mon, 21 Jul 2008 11:50:00 +0200

> probably know it already.

Yes, but it makes sense only if it follows exactly the specification.
 
> Is this good enough for the implementations that use std software

I wrote an XSLT stylesheet that extracts Schematron asserts from the
result of the pyang DSDL plugin and makes them into a full-blown
Schematron schema. Then the skeleton implementation of ISO Schematron
can be used to create a XSLT stylesheet that could indeed validate
instance documents - except that the XPath expressions copied from
must-stmt won't match anything because of the missing (explicit)
namespace prefixes. When I added them by hand, it worked nicely.

> a default namespace.  But I'd rather see that NETCONF and YANG use the

Me too, and actually most tools currently support only XPath 1.0. I
think its wouldn't be a big problem to require a namespace prefix in
must statements - the one that is declared by the YANG module.

Lada

-- 
Ladislav Lhotka, CESNET
PGP Key ID: E74E8C0C