Re: [xslt] xsl:sort again



k_isdale@tpg.com.au writes:
 > Hi all,
 > 
 > Is it possible to define an API that knows how to 
 > compare unicode or at least simpler subsets of it 
 > and still maintain the orginal sorting order of 
 > language used? A possible solution would involve 
 > converting the each unicode character to simpler 
 > range within unicode. This would be an expensive 
 > operation I'm sure. For example
 >   "très" gets converted to "tres"
 > But at least it would be possible.

        I think that the iso8859-1 character set (and possibly others
in that group) maintain correct sorting order within a particular
locale. So, if iso8859-1 is an acceptable subset, all you need to do
is to convert from utf-8 to iso8859-1, and do the sorting on that.

        Further, I think that you can use strcoll() to sort strings so
that "très" and "tres" are treated as identical.

 > Another more general case is that you allow the 
 > user/programmer to define a function to be used 
 > in a "xsl:sort" that takes two nodes and returns  
 > the results of comparing them ie -1, 0, 1. Though 
 > this would put alot more work onto the 
 > user/programmer. And does not sounds like being 
 > part of the XSLT/EXSLT specifications.




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]