Re: transform each character of a string

Subject: Re: transform each character of a string
From: Phil Lanch <phil@xxxxxxxxxxxxxxx>
Date: Mon, 31 Jan 2000 11:27:28 +0000
Frederic Schwebel wrote:
> 
> Hi everybody, I'm (still) working on an XSLT sheet to transform MathML
> into french Braille for Blind people to access it.
> The numbers (1 to 0) have a Braille code corresponding to letters with
> accents when they're in a mathematical context.
> Examples :
> 1 is &acirc;
> 2 is &ecirc;
> 3 is &icirc;
> and so on.
> 
> So when I have for example
> <mn>132</mn>
> in the source, I'd like to have
> &acirc;&icirc;&ecirc;
> in the HTML output.
> 
> I know there is the "translate" function, but it seems to work only for a
> 1 on 1 traduction....

surely this is 1 on 1, because (e.g.) &acirc; represents just one
character?

i.e. if you give your stylesheet a doctype

<!DOCTYPE xsl:stylesheet [
  <!ENTITY acirc  "&#226;">
  <!ENTITY ecirc  "&#234;">
  <!ENTITY icirc  "&#238;">
]>

then you can say

translate(.,'123','&acirc;&ecirc;&icirc;')

-- 

cheers

phil

"When they bring me fear soup to eat,
I try not to eat it, I try to send it back.
But sometimes I'm too afraid to and have to eat it anyway."


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread