[xsl] grouping across a collection()

Subject: [xsl] grouping across a collection()
From: James Cummings <james@xxxxxxxxxxxxxxxxx>
Date: Mon, 20 Dec 2010 15:06:09 +0000
Hi there,

I have a number of files with tei:l elements in them.  So I create a collection:
<xsl:variable name="docs" select="collection($path)"/>
and then want to iterate over the collection grouping all first lines
together, all second lines together, etc. (to create a table with one
line per cell and all poems reflected across the row).

I.e.

<tr><td>line1 from file1</td><td>line1 from file2</td><td>line1 from
file3</td></tr>
<tr><td>line2 from file1</td><td>line2 from file2</td><td>line2 from
file3</td></tr>

Currently I've been trying stuff like:

<xsl:for-each-group select="$docs//tei:l" group-by="position()">
    <tr>
        <xsl:for-each
select="current-group()"><td><xsl:apply-templates
select="."/></td></xsl:for-each>
    </tr>
</xsl:for-each-group>

which is clearly nonsense and just results in a table row with one
cell in it for each line in each poem. (As opposed to one row for all
first lines, second lines, etc.)

Any suggestions on the right way to do this? XSLT2 fine, as this is
just a pre-processing step.

Many thanks,

-James

Current Thread