[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] character maps


Subject: [xsl] character maps
From: Craig Sampson <Craig.Sampson@xxxxxxx>
Date: Wed, 15 May 2013 20:30:00 +0000

Hello,
  I have a situation where I need to convert UTF-8 characters to their NCR
(numeric character representation). I am trying to use character maps but
can't get it to work. My program is written in XSLT version 2 which I am
running with SAXON 9he on windows 7.

Here's a snippet of the file to be converted: (where the special character is
a lower case greek mu ( u + 03BC ))

<foreign><mml:math
xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:mi>l</mml:mi></mml:math><
/foreign>

My character-map contains:

<xsl:output-character character="&#xCEBC;" string="&amp;#x03BC;"/> <!-- lc mu
-->

But my output still contains the mu character in its original state.

I've tried referencing the character-map from a xsl:results-document element:

        <xsl:result-document href="{concat('equation\MathML-',$mCnt,'.xml')}"
                    indent="yes" method="xml" encoding="UTF-8"
                    use-character-maps="LCgreek"
                    doctype-public="-//SAS//DTD authoring 13.0//EN"
                    doctype-system="authoring.dtd">

And I've tried referencing the character-map in xsl:output and then
referencing the output in the result-document:

<xsl:output name="mathOut"
            method="xml" indent="yes"  encoding="UTF-8"
            use-character-maps="LCgreek"
            doctype-system="authoring.dtd"
            doctype-public="-//SAS//DTD authoring 13.0//EN"/>

        <xsl:result-document format="mathOut"
href="{concat('equation\MathML-',$mCnt,'.xml')}">

What am I doing wrong?

Here's the complete character-map:

<xsl:character-map name="LCgreek">
  <xsl:output-character character="&#xCEB1;" string="&amp;#x03B1;"/> <!-- lc
alpha -->
  <xsl:output-character character="&#xCEB2;" string="&amp;#x03B2;"/> <!-- lc
beta -->
  <xsl:output-character character="&#xCEB3;" string="&amp;#x03B3;"/> <!-- lc
gamma -->
  <xsl:output-character character="&#xCEB4;" string="&amp;#x03B4;"/> <!-- lc
delta -->
  <xsl:output-character character="&#xCEB5;" string="&amp;#x03B5;"/> <!-- lc
epsilon -->
  <xsl:output-character character="&#xCEB6;" string="&amp;#x03B6;"/> <!-- lc
zeta -->
  <xsl:output-character character="&#xCEB7;" string="&amp;#x03B7;"/> <!-- lc
eta -->
  <xsl:output-character character="&#xCEB8;" string="&amp;#x03B8;"/> <!-- lc
theta -->
  <xsl:output-character character="&#xCEB9;" string="&amp;#x03B9;"/> <!-- lc
iota -->
  <xsl:output-character character="&#xCEBA;" string="&amp;#x03BA;"/> <!-- lc
kappa -->
  <xsl:output-character character="&#xCEBB;" string="&amp;#x03BB;"/> <!-- lc
lamda -->
  <xsl:output-character character="&#xCEBC;" string="&amp;#x03BC;"/> <!-- lc
mu -->
  <xsl:output-character character="&#xCEBD;" string="&amp;#x03BD;"/> <!-- lc
nu -->
  <xsl:output-character character="&#xCEBE;" string="&amp;#x03BE;"/> <!-- lc
xi -->
  <xsl:output-character character="&#xCEBF;" string="&amp;#x03BF;"/> <!-- lc
omicron -->
  <xsl:output-character character="&#xCF80;" string="&amp;#x03C0;"/> <!-- lc
pi -->
  <xsl:output-character character="&#xCF81;" string="&amp;#x03C1;"/> <!-- lc
rho -->
  <xsl:output-character character="&#xCF82;" string="&amp;#x03C2;"/> <!-- lc
final sigma -->
  <xsl:output-character character="&#xCF83;" string="&amp;#x03C3;"/> <!-- lc
sigma -->
  <xsl:output-character character="&#xCF84;" string="&amp;#x03C4;"/> <!-- lc
tau -->
  <xsl:output-character character="&#xCF85;" string="&amp;#x03C5;"/> <!-- lc
upsilon -->
  <xsl:output-character character="&#xCF86;" string="&amp;#x03C6;"/> <!-- lc
phi -->
  <xsl:output-character character="&#xCF87;" string="&amp;#x03C7;"/> <!-- lc
chi -->
  <xsl:output-character character="&#xCF88;" string="&amp;#x03C8;"/> <!-- lc
psi -->
  <xsl:output-character character="&#xCF89;" string="&amp;#x03C9;"/> <!-- lc
omega -->
</xsl:character-map>

Thanks,
  Craig

--------------------------------------------------------------------
Craig R. Sampson    SAS Institute Inc.  email: craig.sampson@xxxxxxx
  XML Technologies  SAS Campus Drive    phone: (919) 531-7417
                    Cary, NC.  27513    FAX:   (919) 677-4444
--------------------------------------------------------------------
     Please consider the environment before printing this email


Current Thread
Keywords