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

AMENDMENT: Scoped resolution of model attribute for binding eleme nts

From: Tomayko, Ryan <Ryan_Tomayko@stercomm.com>
Date: Wed, 28 Aug 2002 11:02:25 -0400
Message-ID: <D037B3982A54D611BA5E0006293835400100B458@scidubmsg02.amr.stercomm.com>
To: www-forms-editor@w3.org

As an amendment to my previous message, I would also like to suggest the
following editorial revisions should scoped resolution of model attributes
be adopted.


Section 2.4 Multiple Forms Per Document

The paragraph reading:

"In addition, form controls need to specify which model element contains the
instance data to which they bind. This is accomplished through a model
attribute alongside the ref attribute. The default for the model attribute
is the first model element in document order."

should read somewhat as follows

"In addition, form controls _may_ specify which model element contains the
instance data to which they bind. This is accomplished through a model
attribute alongside the ref (or nodeset) attribute. If no model attribute is
specified on the binding element, the nearest ancestor binding element's
model attribute is used. In the absence of a model attribute on any ancestor
binding element, the first Model in document order is used. This also
referred to as 'scoped resolution.'"


- Ryan Tomayko

Sterling Commerce


-----Original Message-----
From: Tomayko, Ryan 
Sent: Tuesday, August 27, 2002 6:16 AM
To: www-forms-editor@w3.org
Subject: Scoped resolution of model attribute for binding elements


The attached document contains a thread from www-forms@w3.org mailing list
that lead to this message.

The latest working draft has resulted in some ambiguity on how the model for
binding elements is selected when no model attribute is specified in
multi-model situations. Specifically, "7.3 Evaluation Context" leads the
reader to believe that the XPath context node can be used to determine the
current model while "3.2.3 Single-Node Binding Attributes" and "3.2.4
Node-Set Binding Attributes" require a model reference to be declared
explicitly if multiple models exist in the containing document.

This email proposes that the default model of a binding element be inherited
from ancestor elements where possible. Adoption of the method described
below provides authors of XForms document with an intuitive and elegant
design that is consistent with XML namespaces and XPath context nodes (i.e.
model selection uses scoped resolution). 


Proposed Model Selection Process:

The model for any binding element can be established by evaluating the
expression "ancestor-or-self::node()/@model". If the resultant nodeset
contains at least one node, the value of the first node in the nodeset is to
be used. If the resultant nodeset is zero in length, the first model in
document order is to be used.

In short, the model for any binding element can be determined by following
the sequence:

1. The binding element's model attribute is used.
2. The nearest ancestor binding element's model attribute is used. 3. The
first model in document order is used.


These rules should apply to all elements with either "Single-Node Binding
Attributes" or "Node-Set Binding Attributes". 


Suggested Editorial Revisions:

Section 3.2.3 and 3.2.4, the paragraph that reads:

"XForms Model selector. Optional when a containing document contains only
one XForms Model, otherwise required, except when the bind attribute is
present, in which case this attribute has no meaning."

should be changed to:

"XForms Model selector. Specifies the id of a Model to associate this
binding element with. If no model attribute is specified, the nearest
ancestor binding element's model attribute must be used. In the absence of a
model attribute on any ancestor binding element, the first Model in document
order must be used."

As a supplement to the argument above, the following examples may be used to
illustrate how scoped resolution improves the readability of XForms markup
in multi-model situations.

<xf:model id="form1">
	<xf:instance>
		...
	</xf:instance>
</xf:model>

<xf:model id="form2">
	<xf:instance>
		...
	</xf:instance>
</xf:model>

...

<xf:group model="form1">
	<!-- 
	all child binding elements inherit groups model
	removing redundant model attributes for each.
      -->
	<xf:input ref="doc/foo">
		<xf:caption>foo</xf:caption>
	</xf:input>
	<xf:input ref="doc/bar">
		<xf:caption>bar</xf:caption>
	</xf:input>
</xf:group>


<xf:repeat model="form2" nodeset="some/nodeset">
	<!-- 
	all child binding elements inherit repeat's model
	removing redundant model attributes for each.
      -->
	<xf:input ref="foo">
		<xf:caption>foo</xf:caption>
	</xf:input>
	<xf:input ref="bar">
		<xf:caption>bar</xf:caption>
	</xf:input>
</xf:repeat>

Previous drafts stated that if no model attribute was specified, the first
model in document order was to be used as default. This caused problems for
authors as they assumed models would propagate to child elements:

<xf:repeat model="form2" nodeset="some/nodeset">
	<!-- 
	child binding elements still reference form1 even though
	ancestor repeat uses form2. Non-intuitive.
	-->
	<xf:input ref="foo"/>
</xf:repeat>

The current draft states that the model must be specified on all binding
elements in multi-model documents. This seems like overkill. The model is
easily established by interrogating ancestor elements.

<xf:repeat model="form2" nodeset="some/nodeset">
	<!--
	must specify model on each child even though ancestor
	specifies.
	-->
	<xf:input model="form2" ref="foo"/>
</xf:repeat>

Thanks,

- Ryan Tomayko

Sterling Commerce
Received on Wednesday, 28 August 2002 11:02:50 GMT

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