Subject: [netmod] XPath root node for /rpc

From: Andy Bierman <[email-masked]>
Date: Thu, 28 May 2009 09:06:57 -0700

Hi,

[This applies to must-stmt, not just when-stmt.]

The text in 7.19.5  (when-stmt) says the root of
the accessible data tree for /rpc/any-function/input
and /rpc/any-function/output is <any-function>.

The issue of referencing the wrong subtree
(e.g., reference /any-function/output/x
in an input parameter when-stmt) has already been
discussed.  Although not intuitive, it is
consistent with <notification>.  Any errors of this
type in the XPath will be treated as 'no-match'
conditions and not reported as errors.  GI = GO.

The other issue not really mentioned so far is that
the contents of the database cannot be used
at all in conditional object expressions inside
RPC methods or notifications.  The must/when
expressions must use nodes from same subtree
(input, output, or the notification payload).

I don't know if it is worth fixing this limitation,
but perhaps an example would help, showing
an RPC input and/or output with when-stmts.

Andy

---

From: Martin Bjorklund <[email-masked]>
Date: Thu, 28 May 2009 20:55:24 +0200 (CEST)

> and /rpc/any-function/output is <any-function>.

Yes, and it says:

- If the context node represents RPC input parameters, the tree is the
  RPC XML instance document.  The XPath root node has the
  element representing the RPC method being defined as the only
  child.

So in:

  <rpc>
    <any-function>
      <param1>...</param1>
       ...
    </any-function>
  </rpc>

The node 'any-function' is the root, and its children are 'param1'...

> consistent with <notification>.

If you look at it from an instance-document pow, it is easier to
understand.

> Any errors of this

Yes, this is how XPath works.

> an RPC input and/or output with when-stmts.

Maybe... but it is a corner case, and when this happens in real data
models, I suspect most of the time relative paths will be used.  Maybe
we should start a collection of examples of different use cases online
somewhere.

/martin