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

Simplified and Canonical Form of XForms PO example

From: John Boyer <boyerj@ca.ibm.com>
Date: Wed, 12 Mar 2008 08:43:09 -0700
To: Forms WG (new) <public-forms@w3.org>
Message-ID: <OFD4B7890E.0BA1A6A1-ON8825740A.00562D97-8825740A.00565AD1@ca.ibm.com>
SIMPLIFIED:

<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"/>

CANONICAL FORM:

<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="$Price * 
$Quantity/>
  </bind>
  <bind id="Subtotal" nodeset="Subtotal" calculate="sum($LineTotal)"/>
  <bind id="Tax" nodeset="Tax" calculate="$Subtotal * 0.07"/> 
  <bind id="Total" nodeset="Total" calculate="$Subtotal + $Tax"/>
</model>

<repeat bind="row">
    <select1 bind="Product"> ...
    <input bind="Quantity"> ...
    <input bind="Price"> ...
    <output bind="LineTotal" calculate="$Price * $Quantity"/>
</repeat>
<output bind="Subtotal"/>
<output bind="Tax"/>
<output bind="Total"/>

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
Received on Wednesday, 12 March 2008 15:43:33 UTC

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