RE: [xsl] Converting to ASCII equivalent

Subject: RE: [xsl] Converting to ASCII equivalent
From: iwantto keepanon <iwanttokeepanon@xxxxxxxx>
Date: Wed, 24 Aug 2005 01:13:16 +0400 (MSD)
> IMHO no extension would be needed if the OP was willing to invest 
> the time in preparing the ASCII table in xml format. 
 
A table is not really necessary either.  This could easily be expanded 
into what the OP wanted: 
 
<xsl:variable name="char-ranking">  
<![CDATA[  
ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz 
]]>  
</xsl:variable>  
 
<xsl:variable 
   name="char-ord" 
   select="63 + string-length(substring-before($char-ranking,substring($str1, 1, 1)))"  
/> 
 
Note: if $char-ord == 63, then character not found.  If character not 
found, then just copy the char into your output string.  Make sure 
char-ranking contains all possible characters you might want to 
translate into ASCII values. 
 
But recursion is still necessary to process the whole string.  Using 
CDATA, you can represent the entire ASCII chart ... expanding the 
solution is left up to the poster  ;-) 
 
P.S. I'd love to say I invented the ranking technique, but I saw it in 
a 'strcmp' implementation once. 
 
-- 
Rodman

P.P.S. sorry if this is double posted ... having email problems.

Current Thread