And the collation trick also solved another problemette, where a composer called Bru#269;i (it's c with an inverted circumflex) sorted ahead of Bruckner.
 
Tx again, G.
 
----- Original Message -----
From: Michael Kay
To: saxon-help@lists.sourceforge.net
Sent: Thursday, March 11, 2004 5:12 PM
Subject: RE: [saxon] Sorting on Strings

Wouldn’t a simpler solution be to translate(xxx, ‘ ‘, ‘_’) – i.e. replace spaces by underlines?

 

The “correct” solution in Java is probably to set up your own RuleBasedCollator, but I have to confess it’s a lot of work.

 

On the other hand, wouldn’t you get the right answer simply by invoking the Unicode code-point collation,

 

<xsl:sort select=”…” collation=”http://www.w3.org/2003/11/xpath-functions/collation/codepoint”/>

 

?

 

Michael Kay

 


From: saxon-help-admin@lists.sourceforge.net [mailto:saxon-help-admin@lists.sourceforge.net] On Behalf Of Graeme St.Clair
Sent: 11 March 2004 21:29
To: saxon-help@lists.sourceforge.net
Subject: [saxon] Sorting on Strings

 

I found a circumvention for my post of 7 Mar.  Most of my 'catalog' values were things like 'G  4' or 'BWV1063'.  And I thought the suggestion at http://www.dpawson.co.uk/xsl/sect2/N6461.html#d7476e270 might help, if I made sure that all catalog values contained a blank - then I could sort similarly to data-type="number" select="substring-after(.,' ')".  Alas, catalog values for the too-prolific Telemann look like '53 F: 1', meaning the first concerto for 3 instruments in the key of F.  I finally settled for:-

 

 <xsl:sort data-type="text" ... select="translate(detail/@catalog,
   ' ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789',
   '0ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789')"/>

 

Not especially elegant, but it seems to work.