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

Re: <setvalue/> XPath evaluation context improvements (PR#27)

From: (wrong string) é <xforms-issues@mn.aptest.com>
Date: Fri, 15 Jun 2007 09:01:12 -0500
Message-Id: <200706151401.l5FE1Cgg021285@htmlwg.mn.aptest.com>
To: IvanLatysh@yahoo.ca
CC: www-forms-editor@w3.org

Ivan,

thanks for reporting this. To solve this issue we decided to add a context()
function to return the in-scope evaluation context for the element containing
the attribute containing the xpath expression.

Regards,
Ulrich Nicolas Lissé.
For the Forms WG

> 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 Friday, 15 June 2007 14:04:39 GMT

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