sec 4.2.2/lazy authoring

While trying to implement sec 4.2.2 of the spec, I ran into issues that I didn't
know the answer to.  Take this form, for example:

<?xml version="1.0" encoding="ASCII"?>
<html xmlns:xforms="http://www.w3.org/2002/xforms"
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:ev="http://www.w3.org/2001/xml-events">
  <head>
    <style>
      @namespace xforms url("http://www.w3.org/2002/xforms");
  
      /* Should be pseudoelement |::value| instead of |input|,
       * and pseudoclass |:invalid| instead of |[invalid]|
       */
      xforms|*[invalid] input {
        background-color: red;
      }
      /* Should be pseudoclass, |:disabled| instead of |[disabled]| */
      xforms|*[disabled] {
        display: none;
      }
    </style>
    <title>xforms-model-construct-done testcase</title>
    <xforms:model>
      <xforms:instance xmlns="">
        <values>
          <value>100</value>
        </values>
      </xforms:instance>
    </xforms:model>
    <xforms:model id="emptyModel">
      <xforms:submission id="emptySubmission" method="post"
action="http://xformstest.org/cgi-bin/echo.sh" />
    </xforms:model>

  </head>
  <body>
    <h2> When you click on submit, empty values should be
         properly submitted inside an root instance node named
         <i>instanceData</i>
    </h2>
    <h3> Exercises sec. 4.2.2 of the spec </h3>
    <p>
      <xforms:group>
        <xforms:output model="emptyModel"
ref="instance('emptyinstance')/emptyValue">
          <xforms:label>label for output: </xforms:label>
        </xforms:output>
        <xforms:output model="emptyModel" value="emptyValue2">
          <xforms:label>label for output: </xforms:label>
        </xforms:output>
        <xforms:submit model="emptyModel" submission="emptySubmission">
          <xforms:label>Click to submit</xforms:label>
        </xforms:submit>
      </xforms:group>
    </p>
  </body>
</html>

When I try this in a variety of processors and click on the submit element, I
get different results.  What I would EXPECT from reading the spec to have
submitted an instance document that looks like this:

<instanceData>
  <emptyValue/>
  <emptyValue2/>
</instanceData>

And after document load and during xforms-model-construct-done processing, the
processors would have created an instance element (invisible to the DOM) with
id="emptyinstance" under the model with id="emptyModel", a child called
'instanceData' and grandchildren called 'emptyValue' and 'emptyValue2'.

Or am I missing something?

Other questions I have, assuming for each that there is an empty model similar
to the example above:
1) should all calls to instance('xxx') that fail to find an instance element
with id='xxx' cause the creation of such an instance element?  Or just the
single node binding attributes (@bind and @ref)?
2) if it is just SNB attrs, then a xf:bind that references a non-existant
instance creates the instance document in all cases, or just when that xf:bind
is actually referenced by a control?  I would think the latter, right? 
3) what if expression looks like ref="instance('emptyinstance1')/codes/group[
<at> code=instance('emptyinstance2')/category]/name"?  Will this one expression
cause the creation of two instance documents with the id's of emptyinstance1 and
emptyinstance2?  
4) Does the creation of 'instance data nodes' as mentioned in the spec include
creation of attributes on nodes?  So in the binding expression in #3, would it
create a node called 'group' with an attribute called 'code'?
5) am I right to assume that if there is an emtpy model like the example above
and I have a control with ref="/values/value" that the control will be
'disabled' because the root would have to be 'instanceData' and not 'values'?
6) Should I be able to have a ref="instance('emptyinstance')/emptyValue" on my
xf:submission element if I connect it up with a lazy authored emptyValue
reference on a control later in the document?

While well intentioned, this lazy authoring is confusing to implement! :=)

Any help appreciated,
--Aaron

Received on Sunday, 29 May 2005 22:37:24 UTC