Evaluation Context of <bind> Computed Expression

When evaluating computed expressions (such as relevant) for a ui control
associated with a bind element, which context should the expression be
evaluated in? The <bind> element's or the control's?

To illustrate the problem, suppose I have the following xform which is a
piece of a purchase order. I want to display repeating line items, but only
if the line item's total (qty * price) is greater than $1000.00.

<xform:xform>
  <xform:instance>
    ....
  </xform:instance>
  <xform:bindings>

    <xform:bind id="qty" 
       ref="po/lineItems/lineItem/qty" 
       relevant="po/lineItems/lineItem[total > 1000]"/>

    <xform:bind id="qty2" 
       ref="qty" relevant=".[total > 1000]"/>

  </xform:bindings>
</xform:xform>
	
....

<xform:repeat node-set="po/lineItems/lineItem">
  <!-- This one is bound to the first bind element above -->
  <xform:input bind="qty">
    <xform:caption>Quantity</xform:caption>
  </xform:input>

  <xform:input bind="qty2">
    <xform:caption>Quantity 2</xform:caption>
  </xform:input>
</xform:repeat>

Assuming that the repeats node-set returned 10 lineItem elements, what do
you expect would happen with each of the two input elements? The first bind
and input assume that the bind's ref and relevant expressions are evaluated
in the context of the bind element. The second assumes that the these
attributes are evaluated in the context of the control. 

If the bind's ref/relevant is evaluated in the context of the bind (first
example), it becomes impossible to use this syntax when the XPath context
node is not "/". If the bind's ref is evaluated in the context of the
control (second example) then you need a control to evaluate the bind.

Also, if an input and it's associated bind both have a ref attribute, which
takes precedence?

This same question can be applied to the context of namespace declarations.
Do the bind expressions get evaluated with the namespace prefixes defined at
the bind level or the control level?

I apologize if any of these questions are covered in the draft.

- Ryan

Ryan Tomayko <rtomayko@stercomm.com>
Sterling Commerce
ext.  5183

Received on Wednesday, 12 September 2001 19:26:27 UTC