Re: The xforms-rebuild Event

OK, let me try one more time.

<instance>
   <data xmlns="">
     <a><b/></a>
     <a><b/></a>
     <a><b/></a>
   </data>
</instance>

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

Here are the rules:

For each bind:
  * If the bind has a ref attribute, it is evaluated [in the in-scope  
evaluation context] to select a sequence of items; otherwise the selected  
sequence of items consists of the in-scope evaluation context.
  * For each item in the selected sequence of items, model item properties  
are applied according to the remaining attributes on the bind element. If  
a node already has a calculate, whitespace or p3ptype property due to the  
processing of prior bind elements, then the xforms-binding-error event is  
dispatched to the element.
  * For each item in the selected sequence of items, any child bind  
elements are recursively processed as described in the three points of  
this list.

Using the three rules as they now stand:

1. The outer bind ref is evaluated, to give {a a a}
2. for each item in {a a a} readonly=true is applied.
3. for each item in {a a a}:
    1. The inner bind is evaluated, to give {a/b a/b a/b}
    2. For each item in {a/b a/b a/b} type=integer is applied
    3. (nothing is done)

The inner loop is performed three times, so that applying type=integer is  
executed 9 times.

However, if instead, we changed the last rule to say

  * Any child bind elements are recursively processed as described in the  
three points of this list.

then we would get

1. The outer bind ref is evaluated, to give {a a a}
2. for each item in {a a a} readonly=true is applied.
3. 1. The inner bind is evaluated, to give {a/b a/b a/b}
    2. For each item in {a/b a/b a/b} type=integer is applied
    3. (nothing is done)

And type=integer is only applied 3 times.

Steven

Received on Friday, 18 November 2016 20:41:07 UTC