xsl-list
[Top] [All Lists]

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

2011-11-05 13:10:14
>How can I make <xsl:for-each-group select="Word" group-by="lower-case(substring(@word,1,1))"> consider 'ch' as a single letter?

You can of course handle the special case as you do in your follow-up post, but I don't think there's a general solution in XSLT.

At the Java level, you can get a RuleBasedCollator for a given language, and you can create a CollationElementIterator that iterates over the collation units of a string given this collator; in your example the first collation unit will be 'ch'. I think there's enough information in the CollationElementIterator to support an extension function

collation-units(string, collation) -> string*

that splits any string into its collation units; and then you could of course do group-by="collation-units(., $czech-collation)[1]".

So I think it's possible in theory!

Michael Kay
Saxonica


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