RE: absolute/relative ref and model-ref 'inheritance'

>According to chapter 7.2, the "instance data always has a single root 
>element" (unlike what the schema says),

P.S. The Schema for XForms had a bug here, but it's fixed now. -m

-----Original Message-----
From: Micah Dubinko [mailto:MDubinko@cardiff.com]
Sent: Monday, August 26, 2002 10:04 AM
To: 'Jérôme Nègre'; Kurt George Gjerde; www-forms@w3.org
Subject: RE: absolute/relative ref and model-ref 'inheritance'



Hi Kurt,

-1-

As Jérôme pointed out, this is an invalid XForms Model by the latest draft.
You could either assemble a single-rooted instance, or have two instances.

<model>
  <instance id="project">
    <name>...</name>
  </instance>

  <instance id="person">
    <name>...</name>
  </instance>
</model>
Then you could skip the whole <group> in the UI (unless you wanted it for
namespace defaulting), and write:

<input ref="instance('project')">
  <label>Project name</label>
</input>
and
<input ref="instance('person')">
  <label>Person name</label>
</input>

(Note that this example, like your original, cheats on namespaces. Normally
the XForms elements and the instance elements would be in different
namespaces)

-2-

An XPath context node is by necessity in a certain 'document'.
So, yes, 'fishpond'.

-3-

Each model keeps track of its context node.

<group model="mod-pond">
is really no different than
<group model="mod-pond" ref=".">

So this example would also work as you expect, pointing to /size/depth
for the 2nd <input> control.

Thanks!
.micah

-----Original Message-----
From: Kurt George Gjerde [mailto:kurt.gjerde@intermedia.uib.no]
Sent: Monday, August 26, 2002 7:16 AM
To: www-forms@w3.org
Subject: absolute/relative ref and model-ref 'inheritance'

Hi,

A few questions about absolute/relative xpaths in @ref,
and about model reference "inheritance".


-1- ref

Take this form:

  <model>
    <instance>
      <project>
        <name>XForms 1.0</name>
      </project>
      <person>
        <name>Janet</name>
      </person>
    </instance>
  </model>
  ...
  <group ref="project">
    <input ref="name">
      <label>Project name</label>
    </input>
    <input ref="/person/name">
      <label>Person name</label>
    </input>
  </group>

I assume that

  'Project name' will be "XForms 1.0"
  (ref 'project' + relative ref 'name' = /project/name)

  'Person name' will be "Janet"
  (absolute ref = /person/name).

Correct? This seems logical to me (see 9.1.1, also quoted below) but
I've seen implementations rendering the second input's ref as
/project/person/name (or /project//person/name!)
(ignoring the initial slash in the @ref).


-2- model

About the @model attribute the (new) WD says (3.2.3): "required, except
when the bind attribute is present".

The group UI element can take single node binding attributes; WD says
(9.1.1): "The binding expression is *solely* for the purpose of authoring
convenience; it allows controls appearing within element 'group' to use
relative XPath expressions." Doesn't mention model, and model isn't
xpath...

Now, are model references 'inherited' down to child element controls? Or
do
they have to be explicitly set for each and every control?

  <model id="city"/>
  <model id="fishpond"/>

  <group model="fishpond">
    <input ref="size"/>
  </group>

Would this be 'size' in the 'fishpond' model or in the default model
('city')? The former I hope.


-3- both

If it's the size of the fishpond...

Take the following form:

  <model id="mod-ocean">
    <instance>
      <size>
        <width>vast</width>
      </size>
    </instance>
  </model>

  <model id="mod-pond">
    <instance>
      <size>
        <depth>200mm</depth>
      </size>
      <depth/>
    </instance>
  </model>

  <group ref="size">

    <input ref="width">
      <label>Ocean width</label>
    </input>

    <group model="mod-pond">
      <input ref="depth">
        <label>Pond depth</label>
      </input>
    </group>

  </group>

Would the @ref in the second input ('pond depth'; in model mod-pond) be
relative to the @ref in the top group element? Would it be
{mod-pond}/size/depth or just {mod-pond}/depth?

I assume (and hope) the former is correct, and that this is just a
weird example (you get what you ask for).



Very grateful for any input,
-Kurt.
__________
kurt george gjerde <kurt.gjerde@intermedia.uib.no>
intermedia uib, university of bergen

Received on Monday, 26 August 2002 13:43:27 UTC