Re: ACTION-2254: Revise <replace/>

LGTM overall.

A few comments:

- We need to specify `xforms-replace` as well.
- The XPath 2 (and 3) data model imposes constraints on text nodes: [1]
    - "the Text Node must not contain the zero-length string as its
content."
    - "two consecutive Text Nodes can never occur as adjacent siblings"

So we should say a little more than "a text node is created from it" and
clarify that this must result in text nodes compatible with the XPath data
model (so an empty string text node would not be created, and if replacing
causes adjacent text nodes, then they must be combined).

This clarification also applies to the recent text for the insert element,
where we say "a text node is created for each atomic value." [2]

-Erik

[1] https://www.w3.org/TR/xpath-datamodel-3/#TextNode
[2]
https://www.w3.org/community/xformsusers/wiki/XForms_2.0#The_insert_Element


On Wed, May 8, 2019 at 2:28 AM Steven Pemberton <steven.pemberton@cwi.nl>
wrote:

> The replace element
>
> This action replaces an instance data node with another, a complement of
> setvalue.
>
> Common Attributes: Common, Events, Action Common, Single Item Binding
>
> Special Attribute:
>
> with
>       Required expression giving an item which will replace the Single
> Item
> Binding.
>
> Content: EMPTY.
>
> The Single Item Binding is evaluated to give the target node; if it does
> not select an instance data node, or the instance data node or its parent
> is readonly,
> the action has no effect.
>
> The with attribute is evaluated in the Element Evaluation Context to give
> an item; the
> first-item rule is applied if necessary. If the item is an atomic value,
> a
> text node is created from it.
>
> If there is a node type conflict between the source node and the target
> (for example, trying to replace an attribute with an element), an
> xforms-action-error event with an error-type of replace-with is
> dispatched, and the action has no further effect.
>
> The target node is replaced with the source node (including its entire
> subtree), and the xforms-replace event is dispatched with appropriate
> context information to the instance containing the target node.
>
> Example
>
> <replace ref="address" with="contact/address[@type='home']"/>
>
>
> On Wed, 01 May 2019 15:13:56 +0200, XForms Users Community Group Issue
> Tracker <sysbot+tracker@w3.org> wrote:
>
> > ACTION-2254: Revise <replace/>
> >
> > https://www.w3.org/2005/06/tracker/xforms/actions/2254
> >
> > Assigned to: Steven Pemberton
> >
> >
> >
> >
> >
> >
> >
>
>

Received on Wednesday, 22 May 2019 06:38:02 UTC