Subject: Re: [xsl] Can group-by treat its target it two ways? From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> Date: Sat, 05 Nov 2011 14:41:41 -0400 |
Don't forget you can also use starts-with() for your tests, and then you don't have to sometimes use a length of 1 and sometimes use a length of 2.
' orHi 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 'D
lower-case(substring(@word,1,1)) eq 'E' 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'), '[̀-ͯ]', '')"/> </xsl:function>
Thanks all, Mark
-- Contact us for world-wide XML consulting and instructor-led training Free 5-hour video lecture: XSLT/XPath 1.0 & 2.0 http://ude.my/t37DVX Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Google+ profile: https://plus.google.com/116832879756988317389/about Legal business disclaimers: http://www.CraneSoftwrights.com/legal
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Can group-by treat its ta, Mark | Thread | Re: [xsl] Can group-by treat its ta, Mark |
Re: [xsl] Can group-by treat its ta, Mark | Date | Re: [xsl] Can group-by treat its ta, Mark |
Month |