Another <bind> and <repeat> question. And indirect relationships between binds and controls..

Sorry for the size of this post.

Is it impossible to use a bind attribute on a form control to reference data
inside a repeating structure?

For instance (literally):

<xf:xform>
  <xf:instance>
    <po>
      <lineitems>
         <line qty="5" price="10.00"/>
         <line qty="10" price="3.00"/>
      </lineitems>
    </po>
  </xf:instance>

  <xf:bindings>
     <xf:bind id='b1' ref='po/lineitems/line/@price' isValid='number(.) >
0'/>
  </xf:bindings>
</xf:xform>

...

<xf:repeat nodeset='po/lineitems/line'>
	<xf:input bind='b1'/>
</xf:repeat>


In this case, the input should have a value of 10.00 on both iterations of
the repeat because of the first node rule. It seems that the repeat breaks
the usability of bind in some cases. 

We should be able to get around this by specifying a ref instead of a bind
on the input:

<xf:repeat nodeset='po/lineitems/line'>
	<xf:input ref='@price'/>
</xf:repeat>

This brings up another question: can form control elements and bind elements
have an indirect relationship? The input in the second example does not
explicitly reference the bind, yet they both reference the same node in the
instance doc. If the form controls and bind elements can have an indirect
relationship, then form controls and bind elements have a one to many
relationship. 

This might be better stated as [single-node binding] form controls have a
one-to-one relationship with a node in the instance document. Nodes in the
instance document have a one-to-many relationship with bind elements. Is
this correct, or am I missing something?

- Ryan

Ryan Tomayko <rtomayko@stercomm.com>
Sterling Commerce

Received on Monday, 22 October 2001 01:15:31 UTC