[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Unicode accented letters to simple ASCII equivalen

Subject: Re: Unicode accented letters to simple ASCII equivalents
From: Liam R E Quin <liam@xxxxxx>
Date: Fri, 10 May 2013 13:25:45 -0400
Re:  Unicode accented letters to simple ASCII equivalen
On Fri, 2013-05-10 at 13:07 -0400, Jonina Dames wrote:
> Hi everyone,
> 
> I'm trying to re-map any accented letters from Unicode (in the XML) to 
> simple, un-accented ASCII equivalents (in an output text file). Is there 
> a way to do this in XSLT 1.0?

It depends on several things:
(1) the normalization form of the input;
(2) what you mean by un-accented ASCII equivalents.
(3) whether you can call extension functions

I'm not trying to split hairs - for example C< (u with two strokes over
it, or two dots) should usually turn to ue without the accent, and if
you need all-seven-bit output C can turn to Ae or AE, a: to ss, and so
on.

One way to handle this might be an XML file with specific characters in
an attribute and replacements in content (say), and use key() in XSLT to
look each character up in turn.

Watch that C) can be represented in two ways in Unicode - the precombined
character or an e followed by an acute accent. You can handle the
multiple-character case in XSLT 2 with replace(), and some XSLT 1
implementations might have a regular expression library available.

Normalizing the input first into a fully-decomposed form and then using
a regular expression, or using translate() to identify characters
outside the ASCII range and skipping them, might be simplest.

I won't speculate further because it really depends on the exact
software and environment and on your purpose and exact problem.

Liam

-- 
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/
Ankh: irc.sorcery.net irc.gnome.org freenode/#xml

Current Thread

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-2013 All Rights Reserved.