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

Good comments.

On Tue, 03 Mar 2020 01:04:51 +0100, Erik Bruchez <ebruchez@orbeon.com>  
wrote:

> 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>
Did you mean to use <copy/> here?

So your proposal is that wherever <value/> can be used, <copy/> can be  
used too?

That would mean we would redefine how to tell the difference between a  
simple and a complex selection.

> 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.
A lot of the text got factored out into the section on Selection controls:
https://www.w3.org/community/xformsusers/wiki/XForms_2.0#Selection_Controls

"A selection control can be "simple" or "complex":
   * a simple selection only selects simpleContent values and uses item  
elements to provide the list of values, or an itemset element with a value  
child or attribute;
   * a complex selection selects values consisting of complex types (with  
children nodes) and uses itemset with a copy child or attribute."

> The spec used to say that `xf:copy` must return "must be an element  
> node". >This text is now no longer present.
I think words to that effect are higher up.

> 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.
I think this matches what is there for select1, although I'm not sure what  
you are proposing for attributes.

> 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.
Hmm. I hadn't thought about this before, but what about

<select ref="selection">
<item label="red" copy="choices[colour='red']"/>
<item label="green" copy="choices[colour='green']"/>
<item label="blue" copy="choices[colour='blue']"/>
</select>

> - An item for which `xf:copy` returns the empty sequence must be ignored.
I believe this is already so described.

> - Deselection requires deep comparing the result of `xf:copy` with the  
> bound >element's children nodes. Any tree found is deleted following  
> `xf:delete`.
"For complex selections, the individual subtrees associated with the newly  
selected and deselected items are added or removed individually by using  
insert and delete;" However, it only used the word "matches" rather than  
"deep compare".

>    - What happens if `xf:copy` returns an atomic value?
What does <insert/> do in this case?

> - Selection requires inserting the items following `xf:insert`.
> - Attributes nodes could be supported or not, but if so the behavior  
> should be >described.
What would you propose as being the behaviour?

>
> 3. Mix and match of `xf:copy` and `xf:value`
>
> A selection control can have multiple `xf:itemset` and `xf:item`.
As children of <choices/> you mean?

<select ref="x">
   <choices label="a">
      <item label="a1" value="1"/>
   </choices>
   <choices label="b">
      <itemset .../>
   </choices>
</select>

> 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.
Are there use cases?

Steven

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

Received on Wednesday, 4 March 2020 11:12:58 UTC