W3C home > Mailing lists > Public > public-forms@w3.org > October 2007

MORE ACTION NEEDED (Uli): Better Examples for Insert and Delete

From: John Boyer <boyerj@ca.ibm.com>
Date: Mon, 1 Oct 2007 01:00:36 -0400
To: Ulrich Nicolas Lissť <unl@dreamlab.net>
Cc: "Forms WG (new)" <public-forms@w3.org>
Message-ID: <OF47614C8F.087CAB0B-ON88257367.0016A330-88257367.001B8537@ca.ibm.com>
Hi Uli,

I've done a fair bit of work to incorporate the insert/delete examples 
into the spec.  I added them into a normative appendix rather than 
directly to the actions chapter because then insert and delete look more 
like the other action descriptions.  The appendix also allowed me the 
space to divide your examples into subsections for readability.

I removed your example about keeping a repeat non-empty because that 
exists already in the delete section.

I made quite a few changes to the first four examples, including some 
error corrections and quite a bit of format changes to enhance 
readability.  The main goal of these examples is, I think, to provide 
ease-to-understand usage patterns of insert and delete for common 
operations.  I have done all the work on the first four patterns to show 
how it should be done, and I would like to ask you to please get the 
source bundle [1] and do the same operations on the remaining 11 patterns.

[1] http://www.w3.org/MarkUp/Forms/specs/XForms1.1/xforms11.full.zip

Here are the things that need to be done (again, look to the first four to 
see how to do these things):

1) Please rename the id attributes in each div2 to match the file name.

2) Move the head element from the example to the first child of the div2, 
and give a title appropriate for the filename. I renamed some of your 
examples using the filename; please make the title match (e.g. change 
insert attribute list to copy attribute list).

3) Start out by presenting a pattern that describes the general case. 
Consider whether your current 'operation' really is the general case and 
amend as needed (e.g. you will undoubtedly notice that my changes to the 
first four patterns were based on the need for better generalization). 
Also, use the same markup I did to make the pattern more readable.

4) Put the "Operation" first, and describe the operation.

5) Remove unnecessary markup from the operation.  Remove trigger, label, 
and repeat.  Instead of using index() in at, use an exact number.  You can 
consider doing an 'alternate' version that uses index() if you really 
want, but all this extra markup is making it hard for people to quickly 
digest the material.

6) Change the title of Starting data and Ending data to "Data Before 
Operation" and "Data After Operation"

7) Show what changed between the before and after cases using the same 
markup as I used.  In the case of removing data, put the special markup in 
the "Data Before Operation" so we can see what got removed.  For the Move 
cases, highlight where it is in both the before and after cases.

8) Put the main instance data *before* any prototype instances, and remove 
the id from the main data.  Fix the examples so that they do not call the 
instance function to get at the main data.  It is categorically too nerdy 
to invoke instance() on the main data. 

9) Try not to use context if the nodeset indicates an exact node (i.e. if 
it is OK to no-op when nodeset returns empty).  We only use context on 
prepend and append because the parent node may have no children.

10) Move xmlns="" from xforms:instance to the root of your data.  I know 
the old examples had xmlns="" on xforms:instance, but I have been seeing 
people in the field who copy/paste our data into a context that does not 
have xmlns="", and then everything stops working for them and they think 
XForms is hard when in fact they are being bitten by a property of XML. 
Still, best to avoid trouble here.

11) Consider removing your "Equivalent Operations" .  In the first few I 
did, I found they were not equivalent, just similar (e.g. insert using 
just nodeset really isn't the same as using context and nodeset).  Only 
add an alternate version if you need to show something important.

12) Get rid of all the occurrences of ...  They don't add anything of 
value.

13) I think the nodeset in B9 copy attribute list is wrong.  Remove @*, 
right?

14) Remove unnecessary attributes, like position="after" in Replace 
Element.  Also, put [1] in the nodeset of insert and delete rather than 
bothering with at because the general case pattern will say that nodeset 
indicates the exact node to replace.

15) I think your intent with the nodeset in replace attribute is to make 
the operation not work unless the attribute being replaced exists.  If so, 
make sure the description of the operation says this.  Similarly, some 
kind of note in replace element should say that if the element doesn't 
exist, then the insert will no-op, but so will the delete.

16) In the last example, please add a bit more data so that we show both 
non-contiguous selection from a heterogeneous nodeset operation at the 
same time.  Break the document into two chapters, and have a header and 
then intermixed diagram and paragraph elements.  Let the first child after 
header in the second chapter be a diagram.  Make the nodeset bind to all 
diagram AND paragraph children, then use at to select the first diagram in 
the second chapter.  Set origin to add a new paragraph, and set position 
to before.  Show that the new paragraph is parented by the second chapter.

Add a note or some such to explain that the nodeset can have nodes with 
different local names and different parents, and that in such a case the 
parent of the new node is the same as the parent of the insert location 
node selected by the combination of nodeset and at.

Thanks for all of your help so far, and for all of these additional 
measures.

John M. Boyer, Ph.D.
STSM: Lotus Forms Architect and Researcher
Chair, W3C Forms Working Group
Workplace, Portal and Collaboration Software
IBM Victoria Software Lab
E-Mail: boyerj@ca.ibm.com 

Blog: http://www.ibm.com/developerworks/blogs/page/JohnBoyer





Ulrich Nicolas Lissť <unl@dreamlab.net> 
09/26/2007 07:36 AM

To
John Boyer/CanWest/IBM@IBMCA
cc
ebruchez@orbeon.com, "Forms WG (new)" <public-forms@w3.org>
Subject
Re: ACTION NEEDED ((Erik, Uli): Better Examples for Insert and Delete






John, Erik, all,

I compiled some insert/delete examples. I hope they make a bit sense and
are clear enough for our readers. Please review for errors.

I had a struggle with xmlspec rendering. I couldn't get a table layout
working with example elements. Most of the examples wouldn't fit into a
four-column table anyway.

The examples are broken down to seperate files. These can be included
into actions.xml via entity expansion.

Regards,
Uli.

John Boyer wrote:
> 
> We had hoped to get some time on this during the face to face meeting,
> but the last call issues proved too time consuming (though I would
> characterize our progress as outstanding).
> 
> This still leaves us in a precarious position of needing to have the
> spec ready for CR transition before the publication moratorium that will
> precede the tech plenary.  I need you, Erik and Uli, to help out by
> creating that table of better examples for insert and delete.
> 
> The idea is that we need
> 
> 1) a list of the expected common operations
> 2) develop the insert/delete calls for those operations
> 3) a four column table that has the following columns
> 
> i) operation description
> ii) starting data
> iii) insert or delete call
> iv) ending data
> 
> These operations will be potential targets for ease-of-authoring actions
> in XForms 1.2.
> 
> Starting tomorrow, I need you guys to please please please begin
> exchanging some email on the list to work out the above, divide up the
> subtasks and get this done.  We need to have an idea of how long it will
> take given the "one day a week" commitment you and your organization 
made.
> 
> P.S. Uli, it turns out that it is not Lotus Notes that is messing up the
> accented e at the end of your name, but rather Shane's bug tracker.
> 
> Cheers,
> John M. Boyer, Ph.D.
> STSM: Lotus Forms Architect and Researcher
> Chair, W3C Forms Working Group
> Workplace, Portal and Collaboration Software
> IBM Victoria Software Lab
> E-Mail: boyerj@ca.ibm.com 
> 
> Blog: http://www.ibm.com/developerworks/blogs/page/JohnBoyer
> 


-- 
Ulrich Nicolas Lissť
<?xml version="1.0" encoding="UTF-8"?>
<example diff="add">
    <head>Appending a prototypical element</head>
    <p><term>Starting data</term></p>
    <eg xml:space="preserve">...
&lt;xforms:instance id=&quot;prototypes&quot; xmlns=&quot;&quot;&gt;
    &lt;prototypes&gt;
        &lt;person&gt;
            &lt;name/&gt;
        &lt;/person&gt;
    &lt;/prototypes&gt;
&lt;/xforms:instance&gt;
&lt;xforms:instance id=&quot;people&quot; xmlns=&quot;&quot;&gt;
    &lt;people&gt;
        &lt;person&gt;
            &lt;name&gt;Jane Doe&lt;/name&gt;
        &lt;/person&gt;
    &lt;/people&gt;
&lt;/xforms:instance&gt;
...</eg>
    <p><term>Operation</term></p>
    <eg xml:space="preserve">...
&lt;xforms:trigger&gt;
    &lt;xforms:label&gt;Append new person&lt;/xforms:label&gt;
    &lt;xforms:insert context=&quot;instance(&apos;people&apos;)&quot; 
nodeset=&quot;person&quot; 
origin=&quot;instance(&apos;prototypes&apos;)/person&quot; 
at=&quot;last()&quot; position=&quot;after&quot;/&gt;
&lt;/xforms:trigger&gt;
...</eg>
    <p><term>Ending data</term></p>
    <eg xml:space="preserve">...
&lt;xforms:instance id=&quot;prototypes&quot; xmlns=&quot;&quot;&gt;
    &lt;prototypes&gt;
        &lt;person&gt;
            &lt;name/&gt;
        &lt;/person&gt;
    &lt;/prototypes&gt;
&lt;/xforms:instance&gt;
&lt;xforms:instance id=&quot;people&quot; xmlns=&quot;&quot;&gt;
    &lt;people&gt;
        &lt;person&gt;
            &lt;name&gt;Jane Doe&lt;/name&gt;
        &lt;/person&gt;
        &lt;person&gt;
            &lt;name/&gt;
        &lt;/person&gt;
    &lt;/people&gt;
&lt;/xforms:instance&gt;
...</eg>
    <p><term>Equivalent operation</term></p>
    <eg xml:space="preserve">...
&lt;xforms:trigger&gt;
    &lt;xforms:label&gt;Append new person&lt;/xforms:label&gt;
    &lt;xforms:insert context=&quot;instance(&apos;people&apos;)&quot; 
nodeset=&quot;person&quot; 
origin=&quot;instance(&apos;prototypes&apos;)/person&quot;/&gt;
&lt;/xforms:trigger&gt;
...
&lt;xforms:trigger&gt;
    &lt;xforms:label&gt;Append new person&lt;/xforms:label&gt;
    &lt;xforms:insert 
nodeset=&quot;instance(&apos;people&apos;)/person&quot; 
origin=&quot;instance(&apos;prototypes&apos;)/person&quot;/&gt;
&lt;/xforms:trigger&gt;
...</eg>
</example>

<?xml version="1.0" encoding="UTF-8"?>
<example diff="add">
    <head>Prepending a prototypical element</head>
    <p><term>Starting data</term></p>
    <eg xml:space="preserve">...
&lt;xforms:instance id=&quot;prototypes&quot; xmlns=&quot;&quot;&gt;
    &lt;prototypes&gt;
        &lt;person&gt;
            &lt;name/&gt;
        &lt;/person&gt;
    &lt;/prototypes&gt;
&lt;/xforms:instance&gt;
&lt;xforms:instance id=&quot;people&quot; xmlns=&quot;&quot;&gt;
    &lt;people&gt;
        &lt;person&gt;
            &lt;name&gt;John Doe&lt;/name&gt;
        &lt;/person&gt;
    &lt;/people&gt;
&lt;/xforms:instance&gt;
...</eg>
    <p><term>Operation</term></p>
    <eg xml:space="preserve">...
&lt;xforms:trigger&gt;
    &lt;xforms:label&gt;Prepend new person&lt;/xforms:label&gt;
    &lt;xforms:insert context=&quot;instance(&apos;people&apos;)&quot; 
nodeset=&quot;person&quot; 
origin=&quot;instance(&apos;prototypes&apos;)/person&quot; 
at=&quot;1&quot; position=&quot;before&quot;/&gt;
&lt;/xforms:trigger&gt;
...</eg>
    <p><term>Ending data</term></p>
    <eg xml:space="preserve">...
&lt;xforms:instance id=&quot;prototypes&quot; xmlns=&quot;&quot;&gt;
    &lt;prototypes&gt;
        &lt;person&gt;
            &lt;name/&gt;
        &lt;/person&gt;
    &lt;/prototypes&gt;
&lt;/xforms:instance&gt;
&lt;xforms:instance id=&quot;people&quot; xmlns=&quot;&quot;&gt;
    &lt;people&gt;
        &lt;person&gt;
            &lt;name/&gt;
        &lt;/person&gt;
        &lt;person&gt;
            &lt;name&gt;John Doe&lt;/name&gt;
        &lt;/person&gt;
    &lt;/people&gt;
&lt;/xforms:instance&gt;
...</eg>
    <p><term>Equivalent operation</term></p>
    <eg xml:space="preserve">...
&lt;xforms:trigger&gt;
    &lt;xforms:label&gt;Prepend new person&lt;/xforms:label&gt;
    &lt;xforms:insert 
nodeset=&quot;instance(&apos;people&apos;)/person&quot; 
origin=&quot;instance(&apos;prototypes&apos;)/person&quot; 
at=&quot;1&quot; position=&quot;before&quot;/&gt;
&lt;/xforms:trigger&gt;
...</eg>
</example>

<?xml version="1.0" encoding="UTF-8"?>
<example diff="add">
    <head>Inserting an element into an arbitrary nodeset</head>
    <p><term>Starting data</term></p>
    <eg xml:space="preserve">...
&lt;xforms:instance id=&quot;prototypes&quot; xmlns=&quot;&quot;&gt;
    &lt;prototypes&gt;
        &lt;document/&gt;
        &lt;header/&gt;
        &lt;paragraph/&gt;
    &lt;/prototypes&gt;
&lt;/xforms:instance&gt;
&lt;xforms:instance id=&quot;document&quot; xmlns=&quot;&quot;&gt;
    &lt;document&gt;
        &lt;header&gt;Lorem ipsum&lt;/header&gt;
        &lt;paragraph&gt;Lorem ipsum verterem voluptaria 
...&lt;/paragraph&gt;
        &lt;paragraph&gt;Primis abhorreant delicatissimi 
...&lt;/paragraph&gt;
        &lt;header&gt;Lorem ipsum&lt;/header&gt;
        &lt;header&gt;Lorem ipsum&lt;/header&gt;
    &lt;/document&gt;
&lt;/xforms:instance&gt;
...</eg>
    <p><term>Operation</term></p>
    <eg xml:space="preserve">...
&lt;xforms:repeat id=&quot;structure&quot; 
nodeset=&quot;instance(&apos;document&apos;)/*&quot;&gt;
    ...
&lt;/xforms:repeat&gt;
....
&lt;xforms:trigger&gt;
    &lt;xforms:label&gt;Insert new paragraph&lt;/xforms:label&gt;
    &lt;xforms:insert context=&quot;instance(&apos;document&apos;)&quot; 
nodeset=&quot;*&quot; 
origin=&quot;instance(&apos;prototypes&apos;)/paragraph&quot; 
at=&quot;index(&apos;structure&apos;)&quot; 
position=&quot;after&quot;/&gt;
&lt;/xforms:trigger&gt;
...</eg>
    <note>This example assumes that the index of repeat 
<code>structure</code> is 4 (selecting the second header element)</note>
    <p><term>Ending data</term></p>
    <eg xml:space="preserve">...
&lt;xforms:instance id=&quot;prototypes&quot; xmlns=&quot;&quot;&gt;
    &lt;prototypes&gt;
        &lt;document/&gt;
        &lt;header/&gt;
        &lt;paragraph/&gt;
    &lt;/prototypes&gt;
&lt;/xforms:instance&gt;
&lt;xforms:instance id=&quot;document&quot; xmlns=&quot;&quot;&gt;
    &lt;document&gt;
        &lt;header&gt;Lorem ipsum&lt;/header&gt;
        &lt;paragraph&gt;Lorem ipsum verterem voluptaria 
...&lt;/paragraph&gt;
        &lt;paragraph&gt;Primis abhorreant delicatissimi 
...&lt;/paragraph&gt;
        &lt;header&gt;Lorem ipsum&lt;/header&gt;
        &lt;paragraph/&gt;
        &lt;header&gt;Lorem ipsum&lt;/header&gt;
    &lt;/document&gt;
&lt;/xforms:instance&gt;
...</eg>
    <p><term>Equivalent operation</term></p>
    <eg xml:space="preserve">...
&lt;xforms:trigger&gt;
    &lt;xforms:label&gt;Insert new paragraph&lt;/xforms:label&gt;
    &lt;xforms:insert nodeset=&quot;instance(&apos;document&apos;)/*&quot; 
origin=&quot;instance(&apos;prototypes&apos;)/paragraph&quot; 
at=&quot;index(&apos;structure&apos;)&quot;/&gt;
&lt;/xforms:trigger&gt;
...</eg>
</example>

<?xml version="1.0" encoding="UTF-8"?>
<example diff="add">
    <head>Inserting a prototypical attribute</head>
    <p><term>Starting data</term></p>
    <eg xml:space="preserve">...
&lt;xforms:instance id=&quot;prototypes&quot; xmlns=&quot;&quot;&gt;
    &lt;prototypes&gt;
        &lt;item key=&quot;0&quot; rating=&quot;classified&quot;/&gt;
    &lt;/prototypes&gt;
&lt;/xforms:instance&gt;
&lt;xforms:instance id=&quot;items&quot; xmlns=&quot;&quot;&gt;
    &lt;items&gt;
        &lt;item/&gt;
    &lt;/items&gt;
&lt;/xforms:instance&gt;
...</eg>
    <p><term>Operation</term></p>
    <eg xml:space="preserve">...
&lt;xforms:trigger&gt;
    &lt;xforms:label&gt;Add rating&lt;/xforms:label&gt;
    &lt;xforms:insert context=&quot;instance(&apos;items&apos;)/item&quot; 
nodeset=&quot;@rating&quot; 
origin=&quot;instance(&apos;prototypes&apos;)/item/@rating&quot;/&gt;
&lt;/xforms:trigger&gt;
...</eg>
    <p><term>Ending data</term></p>
    <eg xml:space="preserve">...
&lt;xforms:instance id=&quot;prototypes&quot; xmlns=&quot;&quot;&gt;
    &lt;prototypes&gt;
        &lt;item key=&quot;0&quot; rating=&quot;classified&quot;/&gt;
    &lt;/prototypes&gt;
&lt;/xforms:instance&gt;
&lt;xforms:instance id=&quot;items&quot; xmlns=&quot;&quot;&gt;
    &lt;items&gt;
        &lt;item rating=&quot;classified&quot;/&gt;
    &lt;/items&gt;
&lt;/xforms:instance&gt;
...</eg>
    <p><term>Equivalent operation</term></p>
    <eg xml:space="preserve">...
&lt;xforms:trigger&gt;
    &lt;xforms:label&gt;Add rating&lt;/xforms:label&gt;
    &lt;xforms:insert context=&quot;instance(&apos;items&apos;)&quot; 
nodeset=&quot;item&quot; 
origin=&quot;instance(&apos;prototypes&apos;)/item/@rating&quot;/&gt;
&lt;/xforms:trigger&gt;
...
&lt;xforms:trigger&gt;
    &lt;xforms:label&gt;Add rating&lt;/xforms:label&gt;
    &lt;xforms:insert nodeset=&quot;instance(&apos;items&apos;)/item&quot; 
origin=&quot;instance(&apos;prototypes&apos;)/item/@rating&quot;/&gt;
&lt;/xforms:trigger&gt;
...</eg>
</example>

<?xml version="1.0" encoding="UTF-8"?>
<example diff="add">
    <head>Inserting a complete attribute list</head>
    <p><term>Starting data</term></p>
    <eg xml:space="preserve">...
&lt;xforms:instance id=&quot;prototypes&quot; xmlns=&quot;&quot;&gt;
    &lt;prototypes&gt;
        &lt;item key=&quot;0&quot; rating=&quot;classified&quot;/&gt;
    &lt;/prototypes&gt;
&lt;/xforms:instance&gt;
&lt;xforms:instance id=&quot;items&quot; xmlns=&quot;&quot;&gt;
    &lt;items&gt;
        &lt;item/&gt;
    &lt;/items&gt;
&lt;/xforms:instance&gt;
...</eg>
    <p><term>Operation</term></p>
    <eg xml:space="preserve">...
&lt;xforms:trigger&gt;
    &lt;xforms:label&gt;Add meta data&lt;/xforms:label&gt;
    &lt;xforms:insert context=&quot;instance(&apos;items&apos;)&quot; 
nodeset=&quot;item[2]/@*&quot; origin=&quot;item[1]/@*&quot;/&gt;
&lt;/xforms:trigger&gt;
...</eg>
    <p><term>Ending data</term></p>
    <eg xml:space="preserve">...
&lt;xforms:instance id=&quot;prototypes&quot; xmlns=&quot;&quot;&gt;
    &lt;prototypes&gt;
        &lt;item key=&quot;0&quot; rating=&quot;classified&quot;/&gt;
    &lt;/prototypes&gt;
&lt;/xforms:instance&gt;
&lt;xforms:instance id=&quot;items&quot; xmlns=&quot;&quot;&gt;
    &lt;items&gt;
        &lt;item key=&quot;0&quot; rating=&quot;classified&quot;/&gt;
    &lt;/items&gt;
&lt;/xforms:instance&gt;
...</eg>
    <p><term>Equivalent operation</term></p>
    <eg xml:space="preserve">...
&lt;xforms:trigger&gt;
    &lt;xforms:label&gt;Insert meta data&lt;/xforms:label&gt;
    &lt;xforms:insert context=&quot;instance(&apos;items&apos;)&quot; 
nodeset=&quot;item[2]&quot; origin=&quot;item[1]/@*&quot;/&gt;
&lt;/xforms:trigger&gt;
...</eg>
</example>

f<?xml version="1.0" encoding="UTF-8"?>
<example diff="add">
    <head>Copying an element</head>
    <p><term>Starting data</term></p>
    <eg xml:space="preserve">...
&lt;xforms:instance id=&quot;document&quot; xmlns=&quot;&quot;&gt;
    &lt;document&gt;
        &lt;header&gt;Lorem ipsum&lt;/header&gt;
        &lt;paragraph&gt;Lorem ipsum verterem voluptaria 
...&lt;/paragraph&gt;
        &lt;paragraph&gt;Primis abhorreant delicatissimi 
...&lt;/paragraph&gt;
        &lt;header&gt;Lorem ipsum&lt;/header&gt;
        &lt;header&gt;Lorem ipsum&lt;/header&gt;
    &lt;/document&gt;
&lt;/xforms:instance&gt;
...</eg>
    <p><term>Operation</term></p>
    <eg xml:space="preserve">...
&lt;xforms:repeat id=&quot;structure&quot; 
nodeset=&quot;instance(&apos;document&apos;)/*&quot;&gt;
    ...
&lt;/xforms:repeat&gt;
....
&lt;xforms:trigger&gt;
    &lt;xforms:label&gt;Copy element&lt;/xforms:label&gt;
    &lt;xforms:insert context=&quot;instance(&apos;document&apos;)&quot; 
nodeset=&quot;*&quot; at=&quot;index(&apos;structure&apos;)&quot; 
position=&quot;after&quot;/&gt;
&lt;/xforms:trigger&gt;
...</eg>
    <note>This example assumes that the index of repeat 
<code>structure</code> is 3 (selecting the second paragraph 
element)</note>
    <p><term>Ending data</term></p>
    <eg xml:space="preserve">...
&lt;xforms:instance id=&quot;document&quot; xmlns=&quot;&quot;&gt;
    &lt;document&gt;
        &lt;header&gt;Lorem ipsum&lt;/header&gt;
        &lt;paragraph&gt;Lorem ipsum verterem voluptaria 
...&lt;/paragraph&gt;
        &lt;paragraph&gt;Primis abhorreant delicatissimi 
...&lt;/paragraph&gt;
        &lt;paragraph&gt;Primis abhorreant delicatissimi 
...&lt;/paragraph&gt;
        &lt;header&gt;Lorem ipsum&lt;/header&gt;
        &lt;header&gt;Lorem ipsum&lt;/header&gt;
    &lt;/document&gt;
&lt;/xforms:instance&gt;
...</eg>
    <p><term>Equivalent operation</term></p>
    <eg xml:space="preserve">...
&lt;xforms:trigger&gt;
    &lt;xforms:label&gt;Copy element&lt;/xforms:label&gt;
    &lt;xforms:insert nodeset=&quot;instance(&apos;document&apos;)/*&quot; 
at=&quot;index(&apos;structure&apos;)&quot;/&gt;
&lt;/xforms:trigger&gt;
...</eg>
</example>

<?xml version="1.0" encoding="UTF-8"?>
<example diff="add">
    <head>Copying a whole nodeset</head>
    <p><term>Starting data</term></p>
    <eg xml:space="preserve">...
&lt;xforms:instance id=&quot;source&quot; xmlns=&quot;&quot;&gt;
    &lt;prototypes&gt;
        &lt;person&gt;
            &lt;name&gt;Jane Doe&lt;/name&gt;
        &lt;/person&gt;
        &lt;person&gt;
            &lt;name&gt;John Doe&lt;/name&gt;
        &lt;/person&gt;
        &lt;person&gt;
            &lt;name&gt;Joe Sixpack&lt;/name&gt;
        &lt;/person&gt;
    &lt;/prototypes&gt;
&lt;/xforms:instance&gt;
&lt;xforms:instance id=&quot;destination&quot; xmlns=&quot;&quot;&gt;
    &lt;people/&gt;
&lt;/xforms:instance&gt;
...</eg>
    <p><term>Operation</term></p>
    <eg xml:space="preserve">...
&lt;xforms:trigger&gt;
    &lt;xforms:label&gt;Copy all persons&lt;/xforms:label&gt;
    &lt;xforms:insert 
context=&quot;instance(&apos;destination&apos;)&quot; 
origin=&quot;instance(&apos;source&apos;)/person&quot;/&gt;
&lt;/xforms:trigger&gt;
...</eg>;
    <p><term>Ending data</term></p>
    <eg xml:space="preserve">...
&lt;xforms:instance id=&quot;source&quot; xmlns=&quot;&quot;&gt;
    &lt;prototypes&gt;
        &lt;person&gt;
            &lt;name&gt;Jane Doe&lt;/name&gt;
        &lt;/person&gt;
        &lt;person&gt;
            &lt;name&gt;John Doe&lt;/name&gt;
        &lt;/person&gt;
        &lt;person&gt;
            &lt;name&gt;Joe Sixpack&lt;/name&gt;
        &lt;/person&gt;
    &lt;/prototypes&gt;
&lt;/xforms:instance&gt;
&lt;xforms:instance id=&quot;destination&quot; xmlns=&quot;&quot;&gt;
    &lt;people&gt;
        &lt;person&gt;
            &lt;name&gt;Jane Doe&lt;/name&gt;
        &lt;/person&gt;
        &lt;person&gt;
            &lt;name&gt;John Doe&lt;/name&gt;
        &lt;/person&gt;
        &lt;person&gt;
            &lt;name&gt;Joe Sixpack&lt;/name&gt;
        &lt;/person&gt;
    &lt;/people&gt;
&lt;/xforms:instance&gt;
...</eg>
    <p><term>Equivalent operation</term></p>
    <eg xml:space="preserve">...
&lt;xforms:trigger&gt;
    &lt;xforms:label&gt;Copy all persons&lt;/xforms:label&gt;
    &lt;xforms:insert 
nodeset=&quot;instance(&apos;destination&apos;)&quot; 
origin=&quot;instance(&apos;source&apos;)/person&quot;/&gt;
&lt;/xforms:trigger&gt;
...</eg>
</example>

<?xml version="1.0" encoding="UTF-8"?>
<example diff="add">
    <head>Copying an attribute</head>
    <p><term>Starting data</term></p>
    <eg xml:space="preserve">...
&lt;xforms:instance id=&quot;items&quot; xmlns=&quot;&quot;&gt;
    &lt;items&gt;
        &lt;item key=&quot;23&quot; rating=&quot;classified&quot;/&gt;
        &lt;item key=&quot;42&quot;/&gt;
    &lt;/items&gt;
&lt;/xforms:instance&gt;
...</eg>
    <p><term>Operation</term></p>
    <eg xml:space="preserve">...
&lt;xforms:trigger&gt;
    &lt;xforms:label&gt;Copy rating&lt;/xforms:label&gt;
    &lt;xforms:insert context=&quot;instance(&apos;items&apos;)&quot; 
nodeset=&quot;item[2]/@rating&quot; 
origin=&quot;item[1]/@rating&quot;/&gt;
&lt;/xforms:trigger&gt;
...</eg>
    <p><term>Ending data</term></p>
    <eg xml:space="preserve">...
&lt;xforms:instance id=&quot;items&quot; xmlns=&quot;&quot;&gt;
    &lt;items&gt;
        &lt;item key=&quot;23&quot; rating=&quot;classified&quot;/&gt;
        &lt;item key=&quot;42&quot; rating=&quot;classified&quot;/&gt;
    &lt;/items&gt;
&lt;/xforms:instance&gt;
...</eg>
    <p><term>Equivalent operation</term></p>
    <eg xml:space="preserve">...
&lt;xforms:trigger&gt;
    &lt;xforms:label&gt;Copy rating&lt;/xforms:label&gt;
    &lt;xforms:insert context=&quot;instance(&apos;items&apos;)&quot; 
nodeset=&quot;item[2]&quot; origin=&quot;item[1]/@rating&quot;/&gt;
&lt;/xforms:trigger&gt;
...</eg>
</example>

<?xml version="1.0" encoding="UTF-8"?>
<example diff="add">
    <head>Replacing an element</head>
    <p><term>Starting data</term></p>
    <eg xml:space="preserve">...
&lt;xforms:instance id=&quot;prototypes&quot; xmlns=&quot;&quot;&gt;
    &lt;prototypes&gt;
        &lt;person&gt;
            &lt;name/&gt;
        &lt;/person&gt;
    &lt;/prototypes&gt;
&lt;/xforms:instance&gt;
&lt;xforms:instance id=&quot;people&quot; xmlns=&quot;&quot;&gt;
    &lt;people&gt;
        &lt;person&gt;
            &lt;name&gt;John Doe&lt;/name&gt;
        &lt;/person&gt;
    &lt;/people&gt;
&lt;/xforms:instance&gt;
...</eg>
    <p><term>Operation</term></p>
    <eg xml:space="preserve">...
&lt;xforms:trigger&gt;
    &lt;xforms:label&gt;Reset person&lt;/xforms:label&gt;
    &lt;xforms:action&gt;
        &lt;xforms:insert context=&quot;instance(&apos;people&apos;)&quot; 
nodeset=&quot;person&quot; 
origin=&quot;instance(&apos;prototypes&apos;)/person&quot; 
at=&quot;1&quot; position=&quot;after&quot;/&gt;
        &lt;xforms:delete context=&quot;instance(&apos;people&apos;)&quot; 
nodeset=&quot;person&quot; at=&quot;1&quot;/&gt;
    &lt;/xforms:action&gt;
&lt;/xforms:trigger&gt;
...</eg>
    <p><term>Ending data</term></p>
    <eg xml:space="preserve">...
&lt;xforms:instance id=&quot;prototypes&quot; xmlns=&quot;&quot;&gt;
    &lt;prototypes&gt;
        &lt;person&gt;
            &lt;name/&gt;
        &lt;/person&gt;
    &lt;/prototypes&gt;
&lt;/xforms:instance&gt;
&lt;xforms:instance id=&quot;people&quot; xmlns=&quot;&quot;&gt;
    &lt;people&gt;
        &lt;person&gt;
            &lt;name/&gt;
        &lt;/person&gt;
    &lt;/people&gt;
&lt;/xforms:instance&gt;
...</eg>
    <p><term>Equivalent operation</term></p>
    <eg xml:space="preserve">...
&lt;xforms:trigger&gt;
    &lt;xforms:label&gt;Reset person&lt;/xforms:label&gt;
    &lt;xforms:action&gt;
        &lt;xforms:insert context=&quot;instance(&apos;people&apos;)&quot; 
nodeset=&quot;person&quot; 
origin=&quot;instance(&apos;prototypes&apos;)/person&quot; 
at=&quot;1&quot;/&gt;
        &lt;xforms:delete context=&quot;instance(&apos;people&apos;)&quot; 
nodeset=&quot;person&quot; at=&quot;1&quot;/&gt;
    &lt;/xforms:action&gt;
&lt;/xforms:trigger&gt;
...
&lt;xforms:trigger&gt;
    &lt;xforms:label&gt;Reset person&lt;/xforms:label&gt;
    &lt;xforms:action&gt;
        &lt;xforms:insert 
nodeset=&quot;instance(&apos;people&apos;)/person&quot; 
origin=&quot;instance(&apos;prototypes&apos;)/person&quot; 
at=&quot;1&quot;/&gt;
        &lt;xforms:delete 
nodeset=&quot;instance(&apos;people&apos;)/person&quot; 
at=&quot;1&quot;/&gt;
    &lt;/xforms:action&gt;
&lt;/xforms:trigger&gt;
...</eg>
</example>

<?xml version="1.0" encoding="UTF-8"?>
<example diff="add">
    <head>Replacing an attribute</head>
    <p><term>Starting data</term></p>
    <eg xml:space="preserve">...
&lt;xforms:instance id=&quot;prototypes&quot; xmlns=&quot;&quot;&gt;
    &lt;prototypes&gt;
        &lt;item key=&quot;0&quot;/&gt;
    &lt;/prototypes&gt;
&lt;/xforms:instance&gt;
&lt;xforms:instance id=&quot;items&quot; xmlns=&quot;&quot;&gt;
    &lt;items&gt;
        &lt;item key=&quot;4711&quot;/&gt;
    &lt;/items&gt;
&lt;/xforms:instance&gt;
...</eg>
    <p><term>Operation</term></p>
    <eg xml:space="preserve">...
&lt;xforms:trigger&gt;
    &lt;xforms:label&gt;Reset key&lt;/xforms:label&gt;
    &lt;xforms:insert context=&quot;instance(&apos;items&apos;)/item&quot; 
nodeset=&quot;@key&quot; 
origin=&quot;instance(&apos;prototypes&apos;)/item/@key&quot;/&gt;
&lt;/xforms:trigger&gt;
...</eg>
    <p><term>Ending data</term></p>
    <eg xml:space="preserve">...
&lt;xforms:instance id=&quot;prototypes&quot; xmlns=&quot;&quot;&gt;
    &lt;prototypes&gt;
        &lt;item key=&quot;0&quot;/&gt;
    &lt;/prototypes&gt;
&lt;/xforms:instance&gt;
&lt;xforms:instance id=&quot;items&quot; xmlns=&quot;&quot;&gt;
    &lt;items&gt;
        &lt;item key=&quot;0&quot;/&gt;
    &lt;/items&gt;
&lt;/xforms:instance&gt;
...</eg>
    <p><term>Equivalent operation</term></p>
    <eg xml:space="preserve">...
&lt;xforms:trigger&gt;
    &lt;xforms:label&gt;Reset key&lt;/xforms:label&gt;
    &lt;xforms:insert context=&quot;instance(&apos;items&apos;)&quot; 
nodeset=&quot;item&quot; 
origin=&quot;instance(&apos;prototypes&apos;)/item/@key&quot;/&gt;
&lt;/xforms:trigger&gt;
...
&lt;xforms:trigger&gt;
    &lt;xforms:label&gt;Reset key&lt;/xforms:label&gt;
    &lt;xforms:insert nodeset=&quot;instance(&apos;items&apos;)/item&quot; 
origin=&quot;instance(&apos;prototypes&apos;)/item/@key&quot;/&gt;
&lt;/xforms:trigger&gt;
...</eg>
</example>

<?xml version="1.0" encoding="UTF-8"?>
<example diff="add">
    <head>Replacing an instance</head>
    <p><term>Starting data</term></p>
    <eg xml:space="preserve">...
&lt;xforms:instance id=&quot;prototypes&quot; xmlns=&quot;&quot;&gt;
    &lt;prototypes&gt;
        &lt;shoppingcart/&gt;
        &lt;item&gt;
            &lt;product/&gt;
            &lt;quantity/&gt;
            &lt;unitcost/&gt;
            &lt;price/&gt;
        &lt;/item&gt;
    &lt;/prototypes&gt;
&lt;/xforms:instance&gt;
&lt;xforms:instance id=&quot;shoppingcart&quot; xmlns=&quot;&quot;&gt;
    &lt;shoppingcart&gt;
        &lt;item&gt;
            &lt;product&gt;SKU-0815&lt;/product&gt;
            &lt;quantity&gt;1&lt;/quantity&gt;
            &lt;unitcost&gt;29.99&lt;/unitcost&gt;
            &lt;price&gt;29.99&lt;/price&gt;
        &lt;/item&gt;
        &lt;item&gt;
            &lt;product&gt;SKU-4711&lt;/product&gt;
            &lt;quantity&gt;3&lt;/quantity&gt;
            &lt;unitcost&gt;7.49&lt;/unitcost&gt;
            &lt;price&gt;22.47&lt;/price&gt;
        &lt;/item&gt;
    &lt;/shoppingcart&gt;
&lt;/xforms:instance&gt;
...</eg>
    <p><term>Operation</term></p>
    <eg xml:space="preserve">...
&lt;xforms:trigger&gt;
    &lt;xforms:label&gt;Reset Shopping cart&lt;/xforms:label&gt;
    &lt;xforms:insert 
context=&quot;instance(&apos;shoppingcart&apos;)&quot; 
nodeset=&quot;.&quot; 
origin=&quot;instance(&apos;prototypes&apos;)/shoppingcart&quot;/&gt;
&lt;/xforms:trigger&gt;
...</eg>
    <p><term>Ending data</term></p>
    <eg xml:space="preserve">...
&lt;xforms:instance id=&quot;prototypes&quot; xmlns=&quot;&quot;&gt;
    &lt;prototypes&gt;
        &lt;shoppingcart/&gt;
        &lt;item&gt;
            &lt;product/&gt;
            &lt;quantity/&gt;
            &lt;unitcost/&gt;
            &lt;price/&gt;
        &lt;/item&gt;
    &lt;/prototypes&gt;
&lt;/xforms:instance&gt;
&lt;xforms:instance id=&quot;shoppingcart&quot; xmlns=&quot;&quot;&gt;
    &lt;shoppingcart/&gt;
&lt;/xforms:instance&gt;
...</eg>
    <p><term>Equivalent operation</term></p>
    <eg xml:space="preserve">...
&lt;xforms:trigger&gt;
    &lt;xforms:label&gt;Reset document&lt;/xforms:label&gt;
    &lt;xforms:insert 
context=&quot;instance(&apos;shoppingcart&apos;)&quot; 
origin=&quot;instance(&apos;prototypes&apos;)/shoppingcart&quot;/&gt;
&lt;/xforms:trigger&gt;
...
&lt;xforms:trigger&gt;
    &lt;xforms:label&gt;Reset document&lt;/xforms:label&gt;
    &lt;xforms:insert 
nodeset=&quot;instance(&apos;shoppingcart&apos;)&quot; 
origin=&quot;instance(&apos;prototypes&apos;)/shoppingcart&quot;/&gt;
&lt;/xforms:trigger&gt;
...</eg>
</example>

<?xml version="1.0" encoding="UTF-8"?>
<example diff="add">
    <head>Moving an element</head>
    <p><term>Starting data</term></p>
    <eg xml:space="preserve">...
&lt;xforms:instance id=&quot;playlist-3&quot; xmlns=&quot;&quot;&gt;
    &lt;playlist&gt;
        &lt;name&gt;Music for Airports&lt;/name&gt;
        &lt;track id=&quot;382&quot;/&gt;
        &lt;track id=&quot;461&quot;/&gt;
        &lt;track id=&quot;629&quot;/&gt;
    &lt;/playlist&gt;
&lt;/xforms:instance&gt;
...
&lt;xforms:instance id=&quot;playlist-7&quot; xmlns=&quot;&quot;&gt;
    &lt;playlist&gt;
        &lt;name&gt;Lullabies&lt;/name&gt;
        &lt;track id=&quot;251&quot;/&gt;
        &lt;track id=&quot;331&quot;/&gt;
    &lt;/playlist&gt;
&lt;/xforms:instance&gt;
...</eg>
    <p><term>Operation</term></p>
    <eg xml:space="preserve">...
&lt;xforms:repeat id=&quot;pl-3&quot; 
nodeset=&quot;instance(&apos;playlist-3&apos;)/track&quot;&gt;
    ...
&lt;/xforms:repeat&gt;
....
&lt;xforms:repeat id=&quot;pl-7&quot; 
nodeset=&quot;instance(&apos;playlist-7&apos;)/track&quot;&gt;
    ...
&lt;/xforms:repeat&gt;
....
&lt;xforms:trigger&gt;
    &lt;xforms:label&gt;Move track&lt;/xforms:label&gt;
    &lt;xforms:action&gt;
        &lt;xforms:insert 
context=&quot;instance(&apos;playlist-7&apos;)&quot; 
nodeset=&quot;track&quot; 
origin=&quot;instance(&apos;playlist-3&apos;)/track[index(&apos;pl-3&apos;)]&quot;/&gt;
        &lt;xforms:delete 
context=&quot;instance(&apos;playlist-3&apos;)&quot; 
nodeset=&quot;track&quot; at=&quot;index(&apos;pl-3&apos;)&quot;/&gt;
    &lt;/xforms:action&gt;
&lt;/xforms:trigger&gt;
...</eg>
    <note>This example assumes that the index of repeat <code>pl-3</code> 
is 2 (selecting the second track)</note>
    <p><term>Ending data</term></p>
    <eg xml:space="preserve">...
&lt;xforms:instance id=&quot;playlist-3&quot; xmlns=&quot;&quot;&gt;
    &lt;playlist&gt;
        &lt;name&gt;Music for Airports&lt;/name&gt;
        &lt;track id=&quot;382&quot;/&gt;
        &lt;track id=&quot;629&quot;/&gt;
    &lt;/playlist&gt;
&lt;/xforms:instance&gt;
...
&lt;xforms:instance id=&quot;playlist-7&quot; xmlns=&quot;&quot;&gt;
    &lt;playlist&gt;
        &lt;name&gt;Lullabies&lt;/name&gt;
        &lt;track id=&quot;251&quot;/&gt;
        &lt;track id=&quot;331&quot;/&gt;
        &lt;track id=&quot;461&quot;/&gt;
    &lt;/playlist&gt;
&lt;/xforms:instance&gt;
...</eg>
    <p><term>Equivalent operation</term></p>
    <eg xml:space="preserve">...
&lt;xforms:trigger&gt;
    &lt;xforms:label&gt;Move track&lt;/xforms:label&gt;
    &lt;xforms:action&gt;
        &lt;xforms:insert 
nodeset=&quot;instance(&apos;playlist-7&apos;)/track&quot; 
origin=&quot;instance(&apos;playlist-3&apos;)/track[index(&apos;pl-3&apos;)]&quot;/&gt;
        &lt;xforms:delete 
nodeset=&quot;instance(&apos;playlist-3&apos;)/track&quot; 
at=&quot;index(&apos;pl-3&apos;)&quot;/&gt;
    &lt;/xforms:action&gt;
&lt;/xforms:trigger&gt;
...</eg>
</example>

<?xml version="1.0" encoding="UTF-8"?>
<example diff="add">
    <head>Moving an attribute</head>
    <p><term>Starting data</term></p>
    <eg xml:space="preserve">...
&lt;xforms:instance id=&quot;items&quot; xmlns=&quot;&quot;&gt;
    &lt;items&gt;
        &lt;item key=&quot;23&quot; rating=&quot;classified&quot;/&gt;
        &lt;item key=&quot;42&quot;/&gt;
    &lt;/items&gt;
&lt;/xforms:instance&gt;
...</eg>
    <p><term>Operation</term></p>
    <eg xml:space="preserve">...
&lt;xforms:trigger&gt;
    &lt;xforms:label&gt;Move rating&lt;/xforms:label&gt;
    &lt;xforms:action&gt;
        &lt;xforms:insert context=&quot;instance(&apos;items&apos;)&quot; 
nodeset=&quot;item[2]/@rating&quot; 
origin=&quot;item[1]/@rating&quot;/&gt;
        &lt;xforms:delete context=&quot;instance(&apos;items&apos;)&quot; 
nodeset=&quot;item[1]/@rating&quot;/&gt;
    &lt;/xforms:action&gt;
&lt;/xforms:trigger&gt;
...</eg>
    <p><term>Ending data</term></p>
    <eg xml:space="preserve">...
&lt;xforms:instance id=&quot;items&quot; xmlns=&quot;&quot;&gt;
    &lt;items&gt;
        &lt;item key=&quot;23&quot;/&gt;
        &lt;item key=&quot;42&quot; rating=&quot;classified&quot;/&gt;
    &lt;/items&gt;
&lt;/xforms:instance&gt;
...</eg>
    <p><term>Equivalent operation</term></p>
    <eg xml:space="preserve">...
&lt;xforms:trigger&gt;
    &lt;xforms:label&gt;Move rating&lt;/xforms:label&gt;
    &lt;xforms:action&gt;
        &lt;xforms:insert context=&quot;instance(&apos;items&apos;)&quot; 
nodeset=&quot;item[2]&quot; origin=&quot;item[1]/@rating&quot;/&gt;
        &lt;xforms:delete context=&quot;instance(&apos;items&apos;)&quot; 
nodeset=&quot;item[1]/@rating&quot;/&gt;
    &lt;/xforms:action&gt;
&lt;/xforms:trigger&gt;
...</eg>
</example>

<?xml version="1.0" encoding="UTF-8"?>
<example diff="add">
    <head>Removing an element</head>
    <p><term>Starting data</term></p>
    <eg xml:space="preserve">...
&lt;xforms:instance id=&quot;shoppingcart&quot; xmlns=&quot;&quot;&gt;
    &lt;shoppingcart&gt;
        &lt;item&gt;
            &lt;product&gt;SKU-0815&lt;/product&gt;
            &lt;quantity&gt;1&lt;/quantity&gt;
            &lt;unitcost&gt;29.99&lt;/unitcost&gt;
            &lt;price&gt;29.99&lt;/price&gt;
        &lt;/item&gt;
        &lt;item&gt;
            &lt;product&gt;SKU-4711&lt;/product&gt;
            &lt;quantity&gt;3&lt;/quantity&gt;
            &lt;unitcost&gt;7.49&lt;/unitcost&gt;
            &lt;price&gt;22.47&lt;/price&gt;
        &lt;/item&gt;
    &lt;/shoppingcart&gt;
&lt;/xforms:instance&gt;
...</eg>
    <p><term>Operation</term></p>
    <eg xml:space="preserve">...
&lt;xforms:repeat id=&quot;items&quot; 
nodeset=&quot;instance(&apos;shoppingcart&apos;)/item&quot;&gt;
    ...
&lt;/xforms:repeat&gt;
....
&lt;xforms:trigger&gt;
    &lt;xforms:label&gt;Remove item&lt;/xforms:label&gt;
    &lt;xforms:delete 
context=&quot;instance(&apos;shoppingcart&apos;)&quot; 
nodeset=&quot;item&quot; at=&quot;index(&apos;items&apos;)&quot;/&gt;
&lt;/xforms:trigger&gt;
...</eg>
    <note>This example assumes that the index of repeat <code>items</code> 
is 2 (selecting the second item)</note>
    <p><term>Ending data</term></p>
    <eg xml:space="preserve">...
&lt;xforms:instance id=&quot;shoppingcart&quot; xmlns=&quot;&quot;&gt;
    &lt;shoppingcart&gt;
        &lt;item&gt;
            &lt;product&gt;SKU-0815&lt;/product&gt;
            &lt;quantity&gt;1&lt;/quantity&gt;
            &lt;unitcost&gt;29.99&lt;/unitcost&gt;
            &lt;price&gt;29.99&lt;/price&gt;
        &lt;/item&gt;
    &lt;/shoppingcart&gt;
&lt;/xforms:instance&gt;
...</eg>
    <p><term>Equivalent operation</term></p>
    <eg xml:space="preserve">...
&lt;xforms:trigger&gt;
    &lt;xforms:label&gt;Remove item&lt;/xforms:label&gt;
    &lt;xforms:delete 
context=&quot;instance(&apos;shoppingcart&apos;)/item&quot; 
at=&quot;index(&apos;items&apos;)&quot;/&gt;
&lt;/xforms:trigger&gt;
...
&lt;xforms:trigger&gt;
    &lt;xforms:label&gt;Remove item&lt;/xforms:label&gt;
    &lt;xforms:delete 
nodeset=&quot;instance(&apos;shoppingcart&apos;)/item&quot; 
at=&quot;index(&apos;items&apos;)&quot;/&gt;
&lt;/xforms:trigger&gt;
...</eg>
</example>

<?xml version="1.0" encoding="UTF-8"?>
<example diff="add">
    <head>Removing a complete nodeset</head>
    <p><term>Starting data</term></p>
    <eg xml:space="preserve">...
&lt;xforms:instance id=&quot;playlist-3&quot; xmlns=&quot;&quot;&gt;
    &lt;playlist&gt;
        &lt;name&gt;Music for Airports&lt;/name&gt;
        &lt;track id=&quot;382&quot;/&gt;
        &lt;track id=&quot;461&quot;/&gt;
        &lt;track id=&quot;629&quot;/&gt;
    &lt;/playlist&gt;
&lt;/xforms:instance&gt;
...</eg>
    <p><term>Operation</term></p>
    <eg xml:space="preserve">...
&lt;xforms:trigger&gt;
    &lt;xforms:label&gt;Clear playlist&lt;/xforms:label&gt;
    &lt;xforms:delete context=&quot;instance(&apos;playlist-3&apos;)&quot; 
nodeset=&quot;track&quot;/&gt;
&lt;/xforms:trigger&gt;
...</eg>
    <p><term>Ending data</term></p>
    <eg xml:space="preserve">...
&lt;xforms:instance id=&quot;playlist-3&quot; xmlns=&quot;&quot;&gt;
    &lt;playlist&gt;
        &lt;name&gt;Music for Airports&lt;/name&gt;
    &lt;/playlist&gt;
&lt;/xforms:instance&gt;
...</eg>
    <p><term>Equivalent operation</term></p>
    <eg xml:space="preserve">...
&lt;xforms:trigger&gt;
    &lt;xforms:label&gt;Clear playlist&lt;/xforms:label&gt;
    &lt;xforms:delete 
context=&quot;instance(&apos;playlist-3&apos;)/track&quot;/&gt;
&lt;/xforms:trigger&gt;
...
&lt;xforms:trigger&gt;
    &lt;xforms:label&gt;Clear playlist&lt;/xforms:label&gt;
    &lt;xforms:delete 
nodeset=&quot;instance(&apos;playlist-3&apos;)/track&quot;/&gt;
&lt;/xforms:trigger&gt;
...</eg>
</example>

<?xml version="1.0" encoding="UTF-8"?>
<example diff="add">
    <head>Removing an attribute</head>
    <p><term>Starting data</term></p>
    <eg xml:space="preserve">...
&lt;xforms:instance id=&quot;items&quot; xmlns=&quot;&quot;&gt;
    &lt;items&gt;
        &lt;item key=&quot;23&quot; rating=&quot;classified&quot;/&gt;
    &lt;/items&gt;
&lt;/xforms:instance&gt;
...</eg>
    <p><term>Operation</term></p>
    <eg xml:space="preserve">...
&lt;xforms:trigger&gt;
    &lt;xforms:label&gt;Remove rating&lt;/xforms:label&gt;
    &lt;xforms:delete context=&quot;instance(&apos;items&apos;)/item&quot; 
nodeset=&quot;@rating&quot;/&gt;
&lt;/xforms:trigger&gt;
...</eg>
    <p><term>Ending data</term></p>
    <eg xml:space="preserve">...
&lt;xforms:instance id=&quot;items&quot; xmlns=&quot;&quot;&gt;
    &lt;items&gt;
        &lt;item key=&quot;23&quot;/&gt;
    &lt;/items&gt;
&lt;/xforms:instance&gt;
...</eg>
    <p><term>Equivalent operation</term></p>
    <eg xml:space="preserve">...
&lt;xforms:trigger&gt;
    &lt;xforms:label&gt;Remove rating&lt;/xforms:label&gt;
    &lt;xforms:delete 
context=&quot;instance(&apos;items&apos;)/item/@rating&quot;/&gt;
&lt;/xforms:trigger&gt;
...
&lt;xforms:trigger&gt;
    &lt;xforms:label&gt;Remove rating&lt;/xforms:label&gt;
    &lt;xforms:delete 
nodeset=&quot;instance(&apos;items&apos;)/item/@rating&quot;/&gt;
&lt;/xforms:trigger&gt;
...</eg>
</example>

<?xml version="1.0" encoding="UTF-8"?>
<example diff="add">
    <head>Conditionally removing an element</head>
    <p><term>Starting data</term></p>
    <eg xml:space="preserve">...
&lt;xforms:instance id=&quot;people&quot; xmlns=&quot;&quot;&gt;
    &lt;people&gt;
        &lt;person&gt;
            &lt;name&gt;Jane Doe&lt;/name&gt;
        &lt;/person&gt;
    &lt;/people&gt;
&lt;/xforms:instance&gt;
...</eg>
    <p><term>Operation</term></p>
    <eg xml:space="preserve">...
&lt;xforms:trigger&gt;
    &lt;xforms:label&gt;Remove person&lt;/xforms:label&gt;
    &lt;xforms:delete context=&quot;instance(&apos;people&apos;)&quot; 
nodeset=&quot;person&quot; at=&quot;last()&quot; if=&quot;count(person) 
&gt; 1&quot;/&gt;
&lt;/xforms:trigger&gt;
...</eg>
    <p><term>Ending data</term></p>
    <eg xml:space="preserve">...
&lt;xforms:instance id=&quot;people&quot; xmlns=&quot;&quot;&gt;
    &lt;people&gt;
        &lt;person&gt;
            &lt;name&gt;Jane Doe&lt;/name&gt;
        &lt;/person&gt;
    &lt;/people&gt;
&lt;/xforms:instance&gt;
...</eg>
</example>
Received on Monday, 1 October 2007 05:01:03 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 1 October 2013 22:06:45 UTC