[xsl] alphabetic set of xsl:result-document

Subject: [xsl] alphabetic set of xsl:result-document
From: James Cummings <cummings.james@xxxxxxxxx>
Date: Mon, 22 Aug 2005 13:58:53 +0100
I know I'm just being silly and this should be obvious to me.  Maybe
it is because it is Monday.

Ok, assuming I have an XML input file with at various levels lots of
words marked up <w>as</w> <w>such</w>, and I'm producing an
alphabetically sorted index of them.

Currently this is being done with the following (highly abbreviated
and simplified):

<!-- setup key for words -->
<xsl:key name="word" match="w" use="lower-case(.)" />
<!-- Iniside root template match  group by word then sort -->
<xsl:for-each-group select="//div[@type='psalm']//w"
     <xsl:sort select="lower-case(.)" />
<!-- Output each word (and associated references, etc.) inside an
xsl:for-each -->
        <xsl:for-each select="key('word', lower-case(.)">

What I want to do is group each of the output words and create a
separate file for each letter of the alphabet matched.  I've been
assuming that I put the xsl:result-document in an xsl:for-each inside
the xsl:for-each-group above, but my attempts so far have failed.  So
I guess my questions are how do I say "for-each unique starting-letter
of the words create a result-document only including words starting
with that letter"? And am I right that this should be inside the
xsl:for-each-group ?

Needing more sleep,


James Cummings, Cummings dot James at GMail dot com

Current Thread