Re: Repeat item context

>
>  <instance>
>     <data xmlns="">
>        <item>one</item><item>two</item><item>three</item>
>     </data>
>  </instance>
>
>  <repeat ref="item">
>     <output ref="."/>,
>     <output value="last()"/>,
>     <output value="position()"/>
>  </repeat>
>
> Question one:
>
> Should it output
>
>  one, 1, 1
>  two, 1, 2
>  three, 1, 3
>
> or
>
>  one, 3, 1
>  two, 3, 2
>  three, 3, 3
>

The latter. `last()` and `position()` go together, and `position()` must be
smaller than or equal to `last()`. A common use case is to test for
`position() = last()` to find the last item in a sequence.

Question two: What is the difference between the 'repeat position', and the
> position of the repeat item context?
>

None as far as I an tell!

-Erik

Received on Tuesday, 23 January 2018 17:08:04 UTC