Subject: RE: selecting from sequences
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Thu, 18 Dec 2008 18:08:11 -0000
|
> > couldn't one get there with, say,
> > sequence-before(sequence, item+)
>
> Not really. How would you do "return the subsequence of $S
> before the first element that has @page='2'"?
>
Oh, I see now what you're suggesting: something based on comparing node
identity. Well, for a large class of problems that might work:
sequence-before($chapters, $chapters[@page='2'][1])
But it's clumsy, it conceptually involves scanning the sequence twice (and
therefore can't be streamed without some optimization); and it only works
for nodes (or works differently for atomics).
Michael Kay
http://www.saxonica.com/
|