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

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 UTC