W3C home > Mailing lists > Public > www-forms@w3.org > September 2001

RE: Evaluation Context of <bind> Computed Expression

From: Tomayko, Ryan <Ryan_Tomayko@stercomm.com>
Date: Thu, 13 Sep 2001 09:46:09 -0400
Message-ID: <5FD6397E455FD4118BAE000629383540014833BB@scidubmsg02.isg.stercomm.com>
To: www-forms@w3.org
Thanks for the quick reply. This was also my understanding of the Draft.
Does this mean that it's impossible to use model-item computed expressions
on ui controls contained within a repeat? In the example in my previous
message, the second iteration of the repeat would give unexpected results
with the relevant evaluated in the context of the bind element. 

- Ryan

-----Original Message-----
From: Josef Dietl [mailto:josef@mozquito.com]
Sent: Thursday, September 13, 2001 7:21 AM
To: Tomayko, Ryan; www-forms@w3.org
Subject: RE: Evaluation Context of <bind> Computed Expression

Hi Ryan,

as you ask the question so well, the answer is quick and easy: every
XPath is evaluated in the context of the element it lives in, in the
case of your question the bind element. 

So far, that's my personal understanding based on Working Group
discussion. I'll check with the Working Group at the next telephone
conference and let you know if there were any discrepancies.


> -----Original Message-----
> From: Tomayko, Ryan [mailto:Ryan_Tomayko@stercomm.com]
> Sent: Thursday, September 13, 2001 1:23 AM
> To: 'www-forms@w3.org'
> Subject: 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 Thursday, 13 September 2001 09:46:30 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:36:04 UTC