[XQuery Talk Mailing List Archive Home] [By Date] [By Thread] [By Subject] [By Author] [Recent Entries] [Reply To This Message]

Convert diacritics to low-ascii

Geert Josten geert.josten at daidalos.nl
Tue Jun 21 05:33:11 PDT 2011


  Convert diacritics to low-ascii
Thanx Andy!

Works just fine in XQuery too. But have to admit that it looks a bit funny to me. Replace something with nothing and still end up with all characters? Can anyone explain what this \p{M} is matching? Unicode spec isn't making it much clearer to me.. :-P

Kind regards,
Geert

-----Oorspronkelijk bericht-----
Van: Houghton,Andrew [mailto:http://x-query.com/mailman/listinfo/talk] 
Verzonden: dinsdag 21 juni 2011 14:18
Aan: Geert Josten
Onderwerp: Re:  Convert diacritics to low-ascii

If you are using XSLT 2.0 then convert the string to Unicode NFD or NFKD with normalize-unicode, then use regex replace with a unicode category to remove the diacritics. For example: 

<xsl:variable name="text" as="xsd:string" select="replace(normalize-unicode('abcdëf', 'NFD'), '[\p{M}]', '')" /> 

Hope that helps, Andy


----- Original Message -----
From: http://x-query.com/mailman/listinfo/talk <http://x-query.com/mailman/listinfo/talk>
To: http://x-query.com/mailman/listinfo/talk <http://x-query.com/mailman/listinfo/talk>
Sent: Tue Jun 21 07:32:06 2011
Subject:  Convert diacritics to low-ascii

Hi,

Does anyone know a simple trick to convert characters like é and ä to their low-ascii counterparts?

Kind regards,
Geert

_______________________________________________
http://x-query.com/mailman/listinfo/talk
http://x-query.com/mailman/listinfo/talk





PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2011 All Rights Reserved.