RE: Natural Sort
> Thank you, substring-after and substring-before are perfect. > > The real world data actually has the 3 types of domain names > > EG: > > >> <server dn="media1.mysite.com" id="server392" os="FreeBSD 5.1"/> > >> <server dn="media2.mysite.com" id="Server488" os="Fedora Core 1"/> > >> ... > >> <server dn="media10.mysite.com" id="Server433" os="Fedora Core 1"/> > > >> <server dn="members1.mysite.com" id="server322" os="Debian Linux"/> > >> <server dn="members2.mysite.com" id="Server435" os="Fedora > Core 2"/> > >> ... > >> <server dn="members10.mysite.com" id="Server491" > os="FreeBSD 4.11"/> The internationalisation commmunity (I18N) have spent about twenty years talking about the subtleties of different collating sequences used in different countries, and this has resulted in large libraries of collations available in many different environments, so if you want to collate the way that was popular in Sweden in the 19th century, you can almost certainly do so. But one of the things that really irritates me about this work is that it has been so slow to recognize the kind of alphanumeric sorting you describe here. There's a brief mention in the Unicode Collation Algorithm , but it's explicitly excluded from the algorithm proper. I don't think there's any support for it in the Java collation mechanisms, despite all their power and complexity. In a back-of-book index you want "ISO 8859" to appear before "ISO 10646", and it's usually very hard to achieve. However, in the last year or two I've noticed that an increasing number of products do in fact use this "natural" sequence, for example when listing the files in a directory, Windows XP explorer lists test9 before test10. So perhaps the world is slowly waking up. I'm going to think about how I can incorporate such a feature into Saxon's collation mechanisms, despite the lack of Java support.  http://www.unicode.org/reports/tr10/ (Search for "numeric order", section 1.4, and see 1.9.2, "non-goals", point 2) Michael Kay http://www.saxonica.com/
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format