|
[XQuery Talk Mailing List Archive Home] [By Date] [By Thread] [By Subject] [By Author] [Recent Entries] [Reply To This Message] Convert diacritics to low-asciiGeert Josten geert.josten at daidalos.nlTue Jun 21 05:33:11 PDT 2011
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! 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
|

Cart








