Re: copy action

I am not against a `<replace>` action, in fact it is a pretty fundamental
operation which I think we should have.

But I am not sure that would have to mean "keep the element and replace its
content". What if the `with` points to an element with a different name?

But I might not have understood your suggestion clearly.

I suggest that a `<replace>` action would in effect have to remove the
existing element and replace it with another, but it would do so as an
indivisible operation from the perspective of the user of the action.

-Erik

On Thu, Mar 21, 2019 at 8:31 AM Steven Pemberton <steven.pemberton@cwi.nl>
wrote:

> 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 18:48:04 UTC