- From: Dimitre Novatchev <dnovatchev@gmail.com>
- Date: Fri, 15 Mar 2024 13:35:08 -0700
- To: Michael Kay <mike@saxonica.com>
- Cc: Norm Tovey-Walsh <norm@saxonica.com>, Christian GrĂ¼n <cg@basex.org>, public-xslt-40@w3.org
- Message-ID: <CAK4KnZeG-_2qf2YXFpeRAZk_S0mLFHdd3wr_bj2USRJBjhxAoA@mail.gmail.com>
> Enjoy some bedtime reading: http://www.unicode.org/reports/tr10/ Thank you, Michael, this would make an interesting read, indeed. > We do offer a function fn:collation-key() which, given a string and a collation, > returns a binary value such that the ordering of the binary values corresponds to the order of strings in the collation. > This functionality is very important when delivering things like distinct-values or for-each-group using an arbitrary collation; > it can also be used to construct keys for maps. Yes, I already looked at this, and this is nice compared to having no such function at all, but one must: 1. Know which are all the different characters (symbols) to ask for. 2. How to know that he has asked for all characters/symbols in the collation. Reconstructing this by assembling the results of a series of calls to fn:collation-key() is closer to detective or archaeologist work than of a software developer's work. Why has SQL Server provided such facilities to all of its users (factors of magnitude more than the X* technologies users) but we have no such functionality? Thanks, Dimitre On Fri, Mar 15, 2024 at 11:41 AM Michael Kay <mike@saxonica.com> wrote: > > When sorting using a collation, we must use not the codepoint for a > character, but its index in the sorted characters of this collation. > > This is why it is important to have a function > > > > *fn:collation-characters($collation-name as xs:string) as xs:string * > that returns the sorted (according to this collation) individual > characters of the collation. > > > Collations don't work character-by-character. Firstly, they split a string > into "collation elements" (or collation units) which may contain several > characters, and secondly, they work in a number of passes, sorting first by > the primary weights of each collation unit, then the secondary weights, etc. > > Enjoy some bedtime reading: http://www.unicode.org/reports/tr10/ > > We do offer a function fn:collation-key() which, given a string and a > collation, returns a binary value such that the ordering of the binary > values corresponds to the order of strings in the collation. This > functionality is very important when delivering things like distinct-values > or for-each-group using an arbitrary collation; it can also be used to > construct keys for maps. > > Michael Kay > >
Received on Friday, 15 March 2024 20:35:25 UTC