W3C home > Mailing lists > Public > www-forms-editor@w3.org > October 2002

RE: Response to your XForms comment (0164)

From: Micah Dubinko <MDubinko@cardiff.com>
Date: Wed, 9 Oct 2002 17:56:03 -0700
Message-ID: <BD2DBD26EE0BAA48B1A425C7BE7923002CFF31@csmail.cardiff.com>
To: "'Paul Prescod'" <paul@prescod.net>, "'www-forms-editor@w3.org'" <www-forms-editor@w3.org>

Hi Paul,

Here are further responses to your questions. We hope you find this helpful.
If you can live with this resolution, please respond to say so, clearing the
way for us to progress to CR.

You asked:
>Do I need to just add a dummy [repeat item] to the template anyways?

Yes. We debated this at length, and concluded that it is necessary, exactly
because of the "what happens when zero items are in the repeat" scenario.

>Do I have to filter out the dummy one when I get the data back?

Most of the time, the user will provide at least one item. For example, on
an Amazon order form, there would always be something that gets ordered!

In rare cases where this isn't true, it's possible to trigger a <delete>
action upon form load. This will remove the user-visible dummy item, and
still let a future <insert> operate (which will copy from the
instance-data-as-it-was-initially).

>It seems odd to associate properties of node sets with the individual
nodes.

In one sense, it is similar to this technique in WXS:

  <xsd:element name="item" minOccurs="1" maxOccurs="4">

To look at it another way, each <bind> stands in for a node-set, and thus is
an appropriate place to put minOccurs and maxOccurs constraints.

>What prevents me from having a "bind rule" like this:
[xml]

minOccurs and maxOccurs can be placed anywhere, but they only have an effect
for "repeating" items, which means a <repeat nodeset="x"> or <itemset
nodeset="x">.

The node-set selected by such repeating sets is required in the spec to be a
"homogeneous collection" [defined in 9.3.1 The repeat Element]:

"This node-set must consist of contiguous child element nodes, with the same
local name and namespace name of a common parent node."

So we do specifically address the kind of unusual cases you example
demonstrates. We feel that we've gone as far as a bunch of people sitting
around a table can go, and are ready to let implementers take center stage,
through publication of a Candidate Recommendation document.

Please respond to state that you agree with this Resolution.

Thanks!

.micah (on behalf of the XForms Working Group)


-----Original Message-----
From: Paul Prescod [mailto:paul@prescod.net]
Sent: Tuesday, October 08, 2002 4:33 PM
To: Micah Dubinko; 'www-forms-editor@w3.org'
Subject: Re: Response to your XForms comment (0164)


Micah Dubinko wrote:
> ...
 > In repeating nodesets, at least one of the repeated nodes MUST exist
 > initially, as a template. This allows a bind expression to exist,
 > which will refer to however many nodes exist during form execution,
 > including newly-inserted nodes.

I'm not sure if the specification says clearly that the template node 
must exist. I presumed not but I now see some strong implications that 
it must.

What if the instance data I am initializing the form with simply doesn't 
have an "item"? Do I need to just add a dummy one to the template 
anyways? Do I have to filter out the dummy one when I get the data back?

> The <bind> selects the nodeset of "all my:item elements" and attaches the
> minOccurs and maxOccurs properties. With a <repeat>/<insert>/<delete>
> involved, the number of my:item elements can change, but the nodeset on
the
> bind continues to select all my:item elements.

I think you are trying to take a Schematron-style assertion mechanism 
and merge it with a property-assignment mechanism. maxOccurs and 
minOccurs is a property of a nodeset, whereas (e.g. maxLength and 
minLength) are properties of nodes. Associating properties of nodes with 
nodes, is logical to me. It seems odd to associate properties of node 
sets with the individual nodes.

What prevents me from having a "bind rule" like this:


<instance>
   <my:order>
     <my:item foo="bar">
       <my:amount />
       <my:discount />
     <my:item>
     <my:item foo="nobar">
       <my:amount />
       <my:discount />
     <my:item>
     <my:item foo="bar">
       <my:amount />
       <my:discount />
     <my:item>
   </my:order>
</instance>
<bind ref="my:item[@foo='bar']" minOccurs="0" maxOccurs="4" />

I think you mean to disallow that but I don't see anything to that 
effect in the spec.

  Paul Prescod
Received on Wednesday, 9 October 2002 20:56:10 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 10 June 2009 18:12:12 GMT