W3C home > Mailing lists > Public > public-forms@w3.org > March 2010

Thoughts about ref vs. nodeset

From: Erik Bruchez <ebruchez@orbeon.com>
Date: Wed, 3 Mar 2010 10:09:07 -0800
Message-ID: <e81b48eb1003031009t64541cacuade40dff2a9b77a1@mail.gmail.com>
To: Forms WG <public-forms@w3.org>

(I know Steven was going to summarize the arguments but thought I
would put an idea or two down while they are fresh.)

It seems (please correct me if I misunderstood) that one argument in
favor or either:

* keeping both @ref or @nodeset
* or using one attribute only but adding a new concept/attribute
making a distinction between 2-3 modes

was that this allows making a distinction at the markup level between
those behaviors. An implementation could, without knowledge of the
element/control on which the attribute is present, e.g. implement the
first-node rule or propagate MIPs.

But *right now*, in XForms 1.1, we have the @bind attribute, which can
be used for:

* single-node bindings
* node-set bindings


<xforms:bind  id="my-values" nodeset="value"/>
<xforms:input id="input1" ref="value"/>
<xforms:input id="input2" ref="value[1]"/>
<xforms:input id="input3" bind="my-values"/>
<xforms:repeat id="repeat1" nodeset="value">...</xforms:repeat>
<xforms:repeat id="repeat2" nodeset="value[1]">...</xforms:repeat>
<xforms:repeat id="repeat3" bind="my-values">...</xforms:repeat>

* input1, input2 and input3 all bind to the first <value> element,
even in the case where @bind is used.
* repeat1 and repeat3 bind to all the <value> elements, even in the
case where @bind is used since the bind node-set contains the two
<value> elements.
* Obviously repeat2 binds to the first <value> element since that is
made explicit.

So we already today in XForms 1.1 have the notion that the attribute
name itself is not enough to determine whether the control must look
at the first node only or at all the nodes or whether MIPs should be
read. Further knowledge is needed, whether by matching elements names
or by saying the control, at runtime, consumes what it needs to

I think the above is either saying that:

* @bind is broken anyway
* or @bind is just fine and we wouldn't be creating any new issue by
saying that @ref can be used everywhere (and deprecating @nodeset)

My preference goes to letting individual controls consume whatever
they want, because this is:

* author-friendly: it simplifies the markup, with only one @ref
attribute to rule all bindings!
* extension-friendly: no need to have prior knowledge of element
names, no need to add extra attributes to support any type of
extension control.
* aligned with the concept of encapsulation: let the control determine
its own behavior.

For a current XForms 1.1 author, the only difference would be that now
@ref can be used also on:

* xforms:nodeset
* xforms:repeat
* xforms:itemset

With the twist that @ref now can return more than one item.

>From an implementation point of view, I don't see any issues:

* if the control wants to consume the first node (item) only, or all
of the items, it can do so easily
* if the control wants to consume annotations (MIPs) on one or all the
items, it can do so as well

If you add to that the fact that with XPath 2.0, @nodeset on
xforms:repeat and xforms:itemset is a wrong attribute name anyway,
deprecation of @nodeset makes even more sense.


* We would leave actions unchanged at this point (or update them
separately). They are just different beasts.
* This would be an XForms 1.2 or later feature.

Received on Wednesday, 3 March 2010 18:10:00 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 19:48:40 UTC