sorry I mistakenly used following-sibling in my code example, here an update:
Make sure you first order your items, the next step is breaking it up in
groups of say 5.
Don't try to start with grouping before sorting, that won't work!
I now first sort according to the at attribute, then I test within item
wich position it has within the sorted items list.
is position mod $group is 1 than it's the first of the group, if it's zero,
it's the last.
otherwise it's something in between.
Hope this helps.
RH
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" encoding="Windows-1252" />
<xsl:param name="group">5</xsl:param> <!-- grouping size-->
<xsl:variable name="items" select="count(//item)"/> <!-- total number
of items-->
<xsl:template match="list">
<xsl:apply-templates select="item">
<xsl:sort select="@at" order="ascending"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="item">
<xsl:choose>
<xsl:when test="position() mod $group =1">
<xsl:comment>Begin new group</xsl:comment>
<p><xsl:value-of select="position()"/> - <xsl:apply-templates/></p>
</xsl:when>
<xsl:when test="position() mod $group =0">
<p><xsl:value-of select="position()"/> - <xsl:apply-templates/></p>
<xsl:comment>End group</xsl:comment>
</xsl:when>
<xsl:when test="not(position() mod $group =0) and position() = $items">
<!-- last item in sorted list-->
<p><xsl:value-of select="position()"/> - <xsl:apply-templates/></p>
<xsl:comment>End group</xsl:comment>
</xsl:when>
<xsl:otherwise>
<p><xsl:value-of select="position()"/> - <xsl:apply-templates/></p>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
RH
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list