xsl-list
[Top] [All Lists]

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

2011-11-05 12:38:20
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" group-by="lower-case(substring(@word,1,1))"> <xsl:result-document href="{concat('index/en-', current-grouping-key())}.htm">

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') with
<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?
Mark

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



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--