Re: copy action

So we discussed this in the call, and I thought about an example to  
illustrate the effect using <insert/>, but I'm still not happy.

   <trigger label="Copy value">
     <action ev:event="DOMActivate">
       <setvalue ref="total" value="instance('source')/total"/>
     </action>
   </trigger>

   <trigger label="Copy content">
     <action ev:event="DOMActivate">
       <insert ref="address" origin="instance('source')/address"/>
       <delete ref="address[1]"/>
     </action>
   </trigger>

 From an abstract point of view, it is doing something different, removing  
the element, and replacing it with something else. I still would prefer  
something that leaves the referenced element, and replaces its content  
with the content of another element:

   <trigger label="Copy content">
     <action ev:event="DOMActivate">
       <replace ref="address" with="instance('source')/address"/>
     </action>
   </trigger>

(This is only a strawman; <setcontent/> would also be fine).

I agree that there are some issues to discuss, such as what to do with  
attributes, but I still think this is more obvious than the insert/delete  
route.

Steven


On Wed, 20 Mar 2019 11:47:30 +0100, Steven Pemberton  
<steven.pemberton@cwi.nl> wrote:

> The funniest things come to you just as you are falling asleep.
>
> I was thinking how if you had a hidden select1 with an itemset with  
> <copy/>, and then used a setvalue to change the value of the select1,  
> you could use it to copy whole subtrees from one instance to another,
>
> But then I realised that that just means we are missing a <copy/> action  
> to go alongside <setvalue/>.
>
> Steven

Received on Thursday, 21 March 2019 15:31:16 UTC