Re: [xsl] character map "range" in XSLT

Subject: Re: [xsl] character map "range" in XSLT
From: Liam R E Quin <liam@xxxxxx>
Date: Wed, 12 May 2010 15:44:17 -0400
On Wed, 2010-05-12 at 13:49 -0400, David wrote:
[...]
> But I have a need to "catch all" charactors that are not mapped 
> explicitly (rather then map explicitly the entiure unicode set) and 
> translate them into something like "<UNKNOWN CHARACTER>"
> 
> Any suggestions on how to do this ? I could trivially write a 
> post-processor to do this (maybe a dozen lines of C or java) but if 
> there's a feature directly in XSLT I'd love to try that.

perl -p -e 'BEGIN { use utf8; binmode STDIN, ":utf8"; } s/[^\010\011\012
\015 -\~]/x/g'

(where \010 \011 \012 and \015 are tab, backspace, newline and carriage
return respectively, expressed in octal, and tilde is the highest legal
ASCII character (assuming you don't want DEL).

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 www.advogato.org

Current Thread