Re: [xsl] Can group-by treat its target it two ways?

Subject: Re: [xsl] Can group-by treat its target it two ways?
From: "Mark" <mark@xxxxxxxxxxxx>
Date: Sat, 5 Nov 2011 10:46:07 -0700
Never mind. I found:
<xsl:for-each-group select="Word" group-by="if (lower-case(substring(@word,1,2)) eq 'ch') then 'ch' else lower-case(substring(@word,1,1))">
<xsl:result-document href="{concat('index/cz-', current-grouping-key())}.htm">

-----Original Message----- From: Mark
Sent: Saturday, November 05, 2011 10:38 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: [xsl] Can group-by treat its target it two ways?

I have sorted a file into Czech collation order (Thanks Michael) so that I
have a series of <Word> elements that identify a unique word and all of its
citations for various documents. I next want to combine all the words that
start with the same letter into a file that has the same name as the initial
letter of the word. For English words, this was easy:
<xsl:for-each-group select="Word"
     <xsl:result-document href="{concat('index/en-',

but Czech has a diagraph 'ch' that comes after 'h'. At the moment, I can
produce the list of <Word> elements in the correct order ('ch' follows 'h')
<xsl:for-each-group select="Word"  group-by="@word">
      <xsl:sort select="@word" lang="cs"/>
but its granularity is at the <Word> level. How can I make
<xsl:for-each-group select="Word"
group-by="lower-case(substring(@word,1,1))"> consider 'ch' as a single
letter? (Right now, it is tacking all of the 'ch' words at the end of the
'c' file because of the substring(@word, 1,1) filter.
Or can you see a better approach?

My sorted word list in Czech collated order:
<Word word="hrad">
   <Citation ....../>
   <Citation ...../>
<Word word="chod">
   <Citation ....../>
  <Citation ...../>

Current Thread