xsl-list
[Top] [All Lists]

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

2011-11-05 13:19:01
Hi Michael and Martin,
I believe you are right, no general solution exists for the reasons Michael mentioned. However, for the archives, I ended up with this monstrosity that does the job (ugly as it is):

<xsl:for-each-group select="Word" group-by="if (lower-case(substring(@word,1,1)) eq 'č' or lower-case(substring(@word,1,1)) eq 'ř' or lower-case(substring(@word,1,1)) eq 'š' or lower-case(substring(@word,1,1)) eq 'ž') then lower-case(substring(@word,1,1)) else if (lower-case(substring(@word,1,2)) eq 'ch') then 'ch' else lower-case(substring(cps:remove-diacritics(@word), 1, 1))">

<xsl:result-document href="{concat('index/cz-', current-grouping-key())}.htm">

Where cps:remove-diacritics() is defined as:
<xsl:function name="cps:remove-diacritics">
   <xsl:param name="in-string"/>
<xsl:value-of select="replace(normalize-unicode($in-string, 'NFKD'), '[&#x0300;-&#x036F;]', '')"/>
 </xsl:function>

Thanks all,
Mark



--~------------------------------------------------------------------
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>
--~--