[Bug 4285] [UPD] Replacing optional content

http://www.w3.org/Bugs/Public/show_bug.cgi?id=4285





------- Comment #4 from chamberl@almaden.ibm.com  2007-02-12 20:57 -------
CORRECTS ERRORS IN COMMENT #2 (SORRY)

As I understand it, the update spec does not currently provide any combination
of expressions that is equivalent to the proposed "fold" expression. Here are
two attempts to simulate the effects of the following "fold" expression:

fold <c/> into /a

(1) We could try a delete followed by an insert:

delete /a/c,
insert <c/> after /a/c

In this case, the new node <c/> will be inserted just after the position of the
deleted c-node, but in nondeterministic order with other nodes that are also
inserted after /a/c in the same snapshot. So this approach is not equivalent to
the fold expression.

(2) We could try a conditional with a replace-branch and an insert-branch:

if (/a/c)
then replace /a/c with <c/>
else insert <c/> into /a

This approach has a serious problem: the else-branch does not specify the
position within the parent where the new node should be inserted. It cannot say
"after /a/c" because in this branch we know that /a/c does not exist. So this
approach is also not equivalent to the fold expression. 

Regards,
Don Chamberlin

Received on Monday, 12 February 2007 20:57:13 UTC