Re: [long] nested repeats and index()

Hi,

the inner nested repeat's cursor should be re-initialized to point to 
the first item to avoid error situations, as you point out. In your 
example, the index('repeatBookmarks') should return 1 after the addition 
of a new section, in order to make setValue work.

So maybe 9.3.5 - 3 should be updated from
"3.Finally, the cursor for any repeating sequence that is bound to the 
homogeneous collection where the node was added is updated to point to 
the newly added node."

to something like

"3.Finally, the cursor for any repeating sequence that is bound to the 
homogeneous collection where the node was added is updated to point to 
the newly added node. The cursors for inner nested collections are 
re-initialized to point at the head of the collection."
"

By the way, this applies also to 9.3.6 -3. (delete) and 9.3.7, 
(setindex) when applied to outer repeats.

-mikko


Jérôme Nègre wrote:
> 
> Hi,
> 
> I think that the behaviour of index() and nested repeats isn't well 
> defined in the latest draft.
> 
> ... [long example by Jérôme ]
> index('repeatSections') now returns 2, index('repeatBookmarks') still 
> returns 2.
> 
> However, the Xpath expression 
> section[index('repeatSections')]/bookmark[index('repeatBookmarks')] does 
> not point to an existing element, so trying to use a <setvalue> on the 
> new node would fail.
> 
> Is this interpretation the correct one? If so, a note should be added to 
> the draft that says that using index() on nested repeats may lead to 
> strange (and unexpected) results.
> 
> If this interpration is wrong, because index('repeatBookmarks') should 
> return 1 in step 3 because the value of index('repeatSections') changed, 
> it should also be specified.
> 
> Regards,
> Jérôme

Received on Tuesday, 27 August 2002 09:38:15 UTC