[xsl] Preserving numeric character entity reference

Subject: [xsl] Preserving numeric character entity reference
From: Kjetil Kjernsmo <kjetilk@xxxxxxxxx>
Date: Wed, 14 Feb 2007 11:55:38 +0100

I'm trying to create a purely text-based CAPTCHA, using the Perl module 
Authen::PluggableCaptcha. It has worked well for its author.

It uses various techniques to obfuscate the code the client sees, in the 
hope of putting spammers off sufficiently to make them go elsewhere. It 
is kind of nasty, but CAPTCHAs are generally a bad thing, this one is 
one of the less bad. 

It provides an XHTML fragment that I currently include in an XML 
document, which is transformed to XHTML. I do
 <xsl:copy-of select="/html/body/pagedata/cap:captcha/cap:challenge"/>
which preserves most of the obfuscation. However, the XML parser 
(correctly)  translates the numeric character entity references that 
are one of the obfuscation techniques. 

I can't use the us-ascii output encoding, as is usually suggested in 
cases like these, because, the numeric character entity references are 
actually in the us-ascii range anyway (and we want UTF-8 for the rest). 

Is this doable?

Are there any other obfuscation techniques that can be done easily in 
XSLT that you can suggest?


Kjetil Kjernsmo
Information Systems Developer
Opera Software ASA

Current Thread