That almost did it, but there is something that doesn't work with the first
name. Here is the xml/xsl
<?xml version='1.0'?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:key name="x" match="name" use="lname"/>
<xsl:output method="xml"/>
<xsl:template match="names">
<names>
<xsl:for-each
select="(name[generate-id(.)=generate-id(key('x',lname))])[position()>3]"
<name>
<xsl:copy-of select="lname"/>
<first>
<xsl:copy-of select="key('x',lname)/fname"/>
</first>
</name>
</xsl:for-each>
</names>
</xsl:template>
</xsl:stylesheet>
<names>
<name><lname>Aarron</lname><first>Hank</first></name>
<name><lname>Aarron</lname><first>Ted</first></name>
<name><lname>Aiken</lname><first>Joe</first></name>
<name><lname>Aiken</lname><first>Jill</first></name>
<name><lname>Appleby</lname><first>Joe</first></name>
<name><lname>Appleby</lname><first>Sarah</first></name>
<name><lname>Appleseed</lname><first>John</first></name>
<name><lname>Appleseed</lname><first>Susan</first></name>
<name><lname>Arson</lname><first>Joe</first></name>
<name><lname>Arson</lname><first>Bill</first></name>
<name><lname>Azzure</lname><first>Peg</first></name>
</names>
-----Original Message-----
From: David Carlisle
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Sent: 6/13/2003 10:22 AM
Subject: Re: [xsl] Muenchian Grouping with Position() Constraints
<xsl:key name="x" match="name" use="lname"/>
...
<xsl:for-each
select="(names/name[generate-id(.)=generate-id(key('x',lname))])[positio
n()>3]">
<name>
<xsl:copy-of select="lname"/>
<first>
<xsl:copy-of select="key('x',lname)/fname"/>
</first>
</name>
</xsl:for-each>
________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list