W3C home > Mailing lists > Public > public-xformsusers@w3.org > December 2016

Processing nested binds

From: Steven Pemberton <steven.pemberton@cwi.nl>
Date: Tue, 06 Dec 2016 10:38:47 +0100
To: "public-xformsusers@w3.org" <public-xformsusers@w3.org>, "Nick Van den Bleeken" <Nick.Van.den.Bleeken@inventivegroup.com>, "Steven Pemberton" <steven.pemberton@cwi.nl>
Message-ID: <op.yr1mexyusmjzpq@steven-aspire-s7>
At the recent call, you persuaded me I was wrong on this, so now I want to  
understand why I was wrong, so that I can fix the spec to make it clearer,  
so that others don't make the mistake I made.

So using the spec, I'll explain the steps I thought happened with <bind>,  
and I would be grateful if those of you who said I was wrong to point out  
the error of my thinking.

As an example I will use the following instance, and I am particularly  
interested in the nested <bind ref="b"/>

         <data xmlns="">

     <bind ref="a" readonly="true()">
         <bind ref="b" type="integer"/>

Rebuild says:
"Each bind in the model is applied." [Note that this would include the  
nested bind]

The bind Element says:
"See Evaluation Context for details on how the evaluation context is  
determined for each attribute of the bind element."

Evaluation Context says:
"a binding element is any element that can have a binding attribute, while
a bound element is a binding element that explicitly has a binding

"[If the binding of an element is expressed with the bind attribute, then
the resulting item or sequence is obtained from the referenced bind
element; otherwise] the in-scope evaluation context provides the default
evaluation context for a binding."

"For binding elements that have no ancestor binding elements, the initial
context size and position are 1, and the context item is the top-level
document element node of the default instance of the model referenced by
the model attribute, if any, otherwise of the containing model, if any,
and otherwise of the default model."

"For other binding elements, the nearest ancestor binding element is used:
If the ancestor expresses a Sequence Binding, then the context item is the
sequence's first item, the position is 1, and the size is the size of the
sequence. Additionally, an occurrence of the original binding element is
generated for each of the items in the sequence, with a dynamic in-scope
evaluation context that has a context item of the item of the sequence for
which the occurrence was generated, a size of the size of the sequence,
and a position of the position of the generated item in the sequence."

So expressing a context as <<elem, size, position>>:

The outermost bind has no ancestor; so its context is <<data, 1, 1>>
The innermost bind has an ancestor that expresses a sequence binding. So
the context is <<a[1], 3, 1>>.
Furthermore, the innermost bind is regenerated for each element of
the sequence:
     <<a[1], 3, 1>> <bind ref="b" type="integer"/>
     <<a[2], 3, 2>> <bind ref="b" type="integer"/>
     <<a[3], 3, 3>> <bind ref="b" type="integer"/>

So from my reading of the spec, without having to use the bit of spec that  
"For each item in the sequence, any child bind elements are recursively  
processed as described in the three points of this list.", the nested bind  
is already processed correctly.

What am I doing wrong?

Received on Tuesday, 6 December 2016 09:39:56 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 19:37:47 UTC