W3C home > Mailing lists > Public > www-forms-editor@w3.org > April 2007

<setvalue/> XPath evaluation context improvements

From: Ivan Latysh <IvanLatysh@yahoo.ca>
Date: Wed, 18 Apr 2007 17:42:21 -0400
Message-ID: <1249180113.20070418174221@yahoo.ca>
To: www-forms-editor@w3.org

Hello all,

  I want to propose a change to XForm spec regarding <setvalue/> "value" attribute evaluation context.
  Currently spec force setvalue element to use target node context:
  [copy]
     "The evaluation context for this XPath expression is the result from the Single Node Binding."
  [/copy]
  When in fact it should honour current scope and be consistent with other XForms elements.

  I propose to update <setvalue/> "value" definition with:
  [copy]
  value
    Optional XPath expression to evaluate, with the result stored in the selected instance data node.
    The evaluation context for this XPath expression described in 7.4 Evaluation Context.
  [/copy]

  Here is the real-world use-case that will work after the change:
    <xf:model id="myModel">
      <xf:instance id="myInstance" xmlns="">
        <root>
          <fruit>apple</fruit>
          <fruit>orange</fruit>
          <fruit>mandarine</fruit>
          <fruit>tomato</fruit>
          <bad-fruit>Unknown</bad-fruit>
        </root>
      </xf:instance>
    </xf:model>
    <xf:repeat nodeset="instance('myInstance')/fruit" model="myModel" id="fruits-repeat">
      <xf:trigger>
        <xf:label>Pick</xf:label>
        <xf:action ev:event="DOMActivate">
          <xf:setvalue ref="instance('myInstance')/bad-fruit" value="."/>
        </xf:action>
      </xf:trigger>
    </xf:repeat>  

  Taking into the consideration that such change may cause certain issues with existing forms John M. Boyer propose to
  add a flag that will govern XForm behaviour:
  [John M. Boyer]
  I couldn't say what to name it, but maybe another attribute on the default model would do the trick.  Something like
  unifiedcontext= "true|false".  The true setting would say that all attributes of an element are evaluated with the
  in-scope evaluation context (i.e. the result of @context, if it appears, or the default otherwise). The true setting
  could even be the default for 1.1, and the false setting could be the default for 1.0 forms.
  [John M. Boyer]

  Also I belive that we can add the "version" attribute to <html/> tag.
  For example:
  <html xmlns="http://www.w3.org/1999/xhtml" xmlns:xf="http://www.w3.org/2002/xforms"
   xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns:xsd="http://www.w3.org/2001/XMLSchema" xf:version="1.1">
  

-- 
Best regards,
 Ivan                          mailto:IvanLatysh@yahoo.ca
Received on Wednesday, 18 April 2007 21:46:12 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 10 June 2009 18:12:15 GMT