[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

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

Subject: Re: Can group-by treat its target it two ways?
From: "Mark" <mark@xxxxxxxxxxxx>
Date: Sat, 5 Nov 2011 10:46:07 -0700
Re:  Can group-by treat its target it two ways?
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">
Mark


-----Original Message----- From: Mark
Sent: Saturday, November 05, 2011 10:38 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: 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"
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>

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.