Feedback for "9.9.5.1 The copy Element (for itemset)"

All,

The following is some feedback on the current spec text for `xf:copy` [1]
as we are implementing the feature.

1. "It can only be used within itemset elements."

This is an unnecessary restriction, which was in XForms 1.1 too. It can
also work with `xf:item` without any issue so I think we should lift this
restriction.

    <select>
        <item>
            <label>Chocolate</label>
            <value ref="instance('chocolate')"/>
        </item>
        <item>
            <label>Strawberry</label>
            <value ref="instance('strawberry')"/>
        </item>
    </select>

2. The text is now under-specified

The behavior is now entirely specified by the following text:

     "it works with subtrees of instance data"

I think that this is not enough.

The spec used to say that `xf:copy` must return "must be an element node".
This text is now no longer present.

I think it makes sense to make a distinction between `select1` and `select`:

For `select1`:

- Deselecting an item should clear the content of the bound element (for
attributes, if supported, see below).
- Selecting an item inserts all the items returned by `xf:copy` into the
bound element following `xf:insert`.
- It's ok if `xf:copy` return an empty sequence (simply nothing gets
inserted upon selection).
- Attributes nodes could be supported or not, but if so the behavior should
be described.

For `select`:

- I don't think it makes sense for `xf:copy` to support more than one item,
so `xf:copy` follows the first-item rule.
- An item for which `xf:copy` returns the empty sequence must be ignored.
- Deselection requires deep comparing the result of `xf:copy` with the
bound element's children nodes. Any tree found is deleted following
`xf:delete`.
    - What happens if `xf:copy` returns an atomic value?
- Selection requires inserting the items following `xf:insert`.
- Attributes nodes could be supported or not, but if so the behavior should
be described.

3. Mix and match of `xf:copy` and `xf:value`

A selection control can have multiple `xf:itemset` and `xf:item`. What
happens if there is a mix and match of `xf:copy` and `xf:value`? We could
say that this is implementation-dependent or that this follows the
`xf:copy` logic, with an `xf:value` values behaving like an `xf:copy` that
returns an XPath string value.

-Erik

[1]
https://www.w3.org/community/xformsusers/wiki/XForms_2.0#The_copy_Element_.28for_itemset.29

Received on Tuesday, 3 March 2020 00:05:17 UTC