Re: [xsl] Problem selecting following::code

Subject: Re: [xsl] Problem selecting following::code
From: andrew welch <andrew.j.welch@xxxxxxxxx>
Date: Tue, 11 Oct 2005 12:50:07 +0100
On 10/10/05, watchstone@xxxxxxxxxxx <watchstone@xxxxxxxxxxx> wrote:
> I am taking a list of items and combining/grouping them by their <id> number
(a substring of it) and then outputting each as a separate file.  I asked
about creating multiple output files last week and couldn't get the 2.0
solution to work, so I'm using version 1.1 with saxon 6.5.x so please give a
solution that will work with that.  Here's the structure of my data:

You couldn't get <xsl:result-document> to work in 2.0 so you decided
to use 1.1??  That's madness :)

[snip]
> <!--
> I want to only select the first <item> where
> the first four digits of the <id> element match
> any number of following <item> elements, so this test
> intends to make sure that only the first <item> is selected
> -->

<xsl:for-each-group select="item" group-by="substring(id, 1, 4)">

Then use current-group() to access the elements in the group, and
current-grouping-key() to access the value used to group them
together.

Shorter, concise questions tend to get more answers as the person
answering the question doesn't have to invest too much time in reading
and understanding the problem.

Current Thread