Re: Trying to make the <insert/> element more readable

I see the w3c mail server has messed up the layout, so see the attachment 
for how it should look.


Steven

On Friday 06 February 2026 12:48:25 (+01:00), Steven Pemberton wrote:


https://www.w3.org/community/xformsusers/wiki/XForms_2.0#The_insert_Element

The text for the insert element is two pages of fairly opaque text, which I 
have recently thought about a lot trying to make it more digestible.

Below is a first draft attempt, and still incomplete. Is this a better 
approach?

Steven

=====

The target-sequence is obtained from the element evaluation context.

If the target-sequence is empty:
if there is no origin attribute, the insert action has no effect
if there is an origin attribute:

The origin-sequence is obtained

if the origin-sequence is empty, the insert action has no effectthe insert 
action has no effect
if the origin-sequence is non-empty:

the nodes of the origin-sequence are added one by one to the context 
element

If the target-sequence is non empty:
if there is no origin attribute:

the last element of the target-sequence is copied, and added to the target 
sequence

if there is an origin attribute:

the origin-sequence is obtained

if the origin-sequence is empty, the insert action has no effect
if the origin-sequence is non empty:

the nodes are added one by one to the target sequence.

An origin sequence is obtained by evaluating the origin attribute in the 
in-scope evaluation context, and removing any root nodes (parents of 
document elements) from the resulting sequence. An implementation may 
choose not to include namespace nodes in the origin-sequence, in particular 
if the namespace axis is not supported or if inserting the namespace node 
would make the data model inconsistent.

An element is added to a sequence:

if the sequence has sort properties:

by inserting the element at the appropriate sort position in the sequence

if the sequence does not have sort properties:

by inserting the element according to the at and position values:

if the at attribute is present:

it is evaluated as a number in the Element Evaluation Context and rounded 
to the nearest integer;
if the result is not a number, is less than 1 or is greater than the 
target-sequence size: the insert action has no effect.

Received on Friday, 6 February 2026 14:55:39 UTC