W3C home > Mailing lists > Public > public-xformsusers@w3.org > November 2016

insert and delete

From: Steven Pemberton <steven.pemberton@cwi.nl>
Date: Tue, 22 Nov 2016 21:23:38 +0100
To: "public-xformsusers@w3.org" <public-xformsusers@w3.org>
Message-ID: <op.yrcixobhsmjzpq@steven-aspire-s7>
Insert and delete are symmetrical:

If you try to insert with a value of @at below 1, it inserts at the start;  
with a value larger than the size of the sequence, or with something that  
isn't a number, it inserts at the end.

<instance>
   <data xmlns="">
     <list>
        <item/>
        <item/>
        <item/>
     </list>
     <node/>
   </data>
</instance>
...
<insert context="list" ref="item" at="-100" origin="node"/> - inserts at  
start
<insert context="list" ref="item" at="100" origin="node"/> - inserts at end
<insert context="list" ref="item" at="cat" origin="node"/> - inserts at end

Delete works the same.

<delete context="list" ref="item" at="-100"/> - deletes first item
<delete context="list" ref="item" at="100"/> - deletes last item
<delete context="list" ref="item" at="cat"/> - deletes last item

Now, I'm OK with how insert works. It does a best effort.

However, I'm less happy with deleting when @at is out-of-range, since you  
are losing information.

Personally I'd prefer delete only to delete items if @at is in range.

Steven
Received on Tuesday, 22 November 2016 20:24:17 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 22 November 2016 20:24:17 UTC