Re: split-sequence: position() and last()

Hum...

The spec says

[[
The XPath context for the test option changes over time. For each
document that appears on the source port, the expression is evaluated
with that document as the context document. The context position
(position()) is the position of that document within the sequence and
the context size (last()) is the total number of documents in the
sequence.
]]

So I can't see why
 <p:split-sequence name="head" test="position() = 1"/>
and  <p:split-sequence name="tail" test="position()=last()"/>
wouldn't work

Xmlizer


On Thu, Oct 16, 2008 at 10:58 PM, Norman Walsh <ndw@nwalsh.com> wrote:
> Ages ago, before we adopted p:iteration-position() and
> p:iteration-size(), we thought that we'd overload the standard
> position() and last() functions for that purpose.
>
> In that world, it was possible to imagine that you could get
> "head" and "tail" from split-sequence:
>
>  <p:split-sequence name="head" test="position() = 1"/>
>
> and
>
>  <p:split-sequence name="tail" test="position()=last()"/>
>
> That's not true anymore. And you can't use iteration position and size
> here.
>
> So there's no efficient way to get the head or tail of a sequence.
>
> Bleh.
>
> I fear we should fix that.
>
>                                        Be seeing you,
>                                          norm
>
> --
> Norman Walsh <ndw@nwalsh.com> | It is a paradoxical but profoundly true
> http://nwalsh.com/            | and important principle of life that
>                              | the most likely way to reach a goal is
>                              | to be aiming not at that goal itself
>                              | but at some more ambitious goal beyond
>                              | it.--Arnold Toynbee
>

Received on Thursday, 16 October 2008 23:11:40 UTC