W3C home > Mailing lists > Public > public-forms@w3.org > March 2008

Re: Simplified and Canonical Form of XForms PO example

From: John Boyer <boyerj@ca.ibm.com>
Date: Fri, 14 Mar 2008 18:02:51 -0700
To: Charles F Wiecha <wiecha@us.ibm.com>
Cc: Forms WG (new) <public-forms@w3.org>
Message-ID: <OF907C4F28.D7732FD3-ON8825740B.007B2FAB-8825740D.0005C195@ca.ibm.com>
Hi Charlie (and all),

I hope we can sell what's on the truck, so to speak, for XForms 1.2. 
Adoption of other expression languages like E4X is XForms 2.0.

However, I have shared your concern about the dollar signs, and it occurs 
to me now that the canonical form I originally wrote, modified with the 
understanding that identified binds create variables, results in the 
interesting circumstance that *both* simplified syntax forms work.  I 
think this is the way out of the woods.

To be clear, the following two alternatives are served by the same 
canonical form (farther below):

Alternative 1 (dollar signs):

<repeat name="row"> 
    <select1 name="Product"> ... 
    <input name="Quantity"> ... 
    <input name="Price"> ... 
    <output name="LineTotal" calculate="$Price * $Quantity"/> 
</repeat> 
<output name="Subtotal" calculate="sum($LineTotal)"/> 
<output name="Tax" calculate="$Subtotal * 0.07"/> 
<output name="Total" calculate="$Subtotal + $Tax"/> 

Alternative 2 (no dollar signs):

<repeat name="order" nodeset="row"> 
    <select1 name="Product"> ... 
    <input name="Quantity"> ... 
    <input name="Price"> ... 
    <output name="LineTotal" calculate="Price * Quantity"/> 
</repeat> 
<output name="Subtotal" calculate="sum(order/row/LineTotal)"/> 
<output name="Tax" calculate="Subtotal * 0.07"/> 
<output name="Total" calculate="Subtotal + Tax"/> 


Canonical Form that supports both:

<model> 
  <instance> 
    <data> 
      <row> 
         <Product>... 
         <Price>... 
         <Quantity>... 
         <LineTotal>... 
      </row> 
      <row> 
         <Product>... 
         <Price>... 
         <Quantity>... 
         <LineTotal>... 
      </row> 
      <Subtotal>... 
      <Tax>... 
      <LineTotal>... 
    </data> 
  </instance> 
 
  <bind id="row" nodeset="row"> 
    <bind id="Product" nodeset="Product"/> 
    <bind id="Price" nodeset="Price"/> 
    <bind id="Quantity" nodeset="Quantity"/> 
    <bind id="LineTotal" nodeset="LineTotal">
       <calculate context=".." value="Either expression works: Price * 
Quantity, $Price * $Quantity "/> 
    </bind>
  </bind> 
  <bind id="Subtotal" nodeset="Subtotal">
     <calculate context=".." value="Either expression works: 
sum(row/LineTotal), sum($LineTotal)"/> 
  </bind>
  <bind id="Tax" nodeset="Tax">
     <calculate context=".." value="Either expression works: Subtotal * 
0.07, $Subtotal * 0.07"/>   
  </bind>
  <bind id="Total" nodeset="Total">
     <calculate context=".." value="Either expression works: Subtotal + 
Tax, $Subtotal + $Tax"/> 
  </bind>
</model> 

John M. Boyer, Ph.D.
Senior Technical Staff Member
Lotus Forms Architect and Researcher
Chair, W3C Forms Working Group
Workplace, Portal and Collaboration Software
IBM Victoria Software Lab
E-Mail: boyerj@ca.ibm.com 

Blog: http://www.ibm.com/developerworks/blogs/page/JohnBoyer
Blog RSS feed: 
http://www.ibm.com/developerworks/blogs/rss/JohnBoyer?flavor=rssdw





Charles F Wiecha <wiecha@us.ibm.com> 
Sent by: public-forms-request@w3.org
03/12/2008 01:20 PM

To
John Boyer/CanWest/IBM@IBMCA
cc
Forms WG (new) <public-forms@w3.org>, public-forms-request@w3.org
Subject
Re: Simplified and Canonical Form of XForms PO example







I like the direction this simplified syntax is taking.  One exception,
however, concerns the "$" notation used in calculate.  I understand that
this is to expose XPath variables with the appropriate evaluation context
to make expressions easy -- avoiding the need for explicit navigation up
and down the implicit data model.

What would the WG think of defining a new non-XPath based attribute
supporting an alternative expression language (perhaps E4X?) that would
avoid the need for this particular bit of ugliness?

Thanks, Charlie

Charles Wiecha
Manager, Multichannel Web Interaction
IBM T.J. Watson Research Center
P.O. Box 704
Yorktown Heights, N.Y.  10598
Phone: (914) 784-6180, T/L 863-6180, Cell: (914) 320-2614
wiecha@us.ibm.com
Received on Saturday, 15 March 2008 01:03:32 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 1 October 2013 22:06:47 UTC