Re: [xsl] Unicode and child element

Subject: Re: [xsl] Unicode and child element
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Thu, 28 Aug 2008 09:13:01 -0400
Sorry, my syntax was incomplete ... please see below:

At 2008-08-28 09:05 -0400, G. Ken Holman wrote:
I get the impression that you have copied a partial solution to your problem because only one step is missing, yet the result evidence you present seems not to match what the code you have would produce. I'll just focus my answer on your code and not on your evidence.

At 2008-08-28 17:51 +0530, Pankaj Chaturvedi wrote:
<xsl:function name="my:reverse-string">
        <xsl:param name="arg"/>
                <xsl:sequence
select="replace(codepoints-to-string(string-to-codepoints($arg)),
'\[#x([0-9A-Za-z]+)\]', '&#xE000;#x$1;')"/>
</xsl:function>

Okay, the above does *not* put "[#xUUUU]" into the result tree as you contend.


It puts "&#xE000;UUUU;" into the result tree.

I gather you want "&UUUU;" in the serialized version of the result tree.

Actually, you need "&#xUUUU;" in the serialized version of the result tree.


Using &#xE000; is a typical approach to using output character maps in serialization to get file results that are not possible using default serialization.

...
I've done it earlier but seems to be completely lost today (may be tired).

It looks to me like what you probably did was:


<xsl:output use-character-maps="escape-my-numeric-character-reference"/>

  <xsl:character-map name="escape-my-numeric-character-reference">
    <xsl:output-character character="&#xe000;" string="&amp;"/>
  </xsl:character-map>

The above should be as follows to properly encode the numeric character reference introducer:


  <xsl:character-map name="escape-my-numeric-character-reference">
    <xsl:output-character character="&#xe000;" string="&amp;#x"/>
  </xsl:character-map>

. . . . . . . . . . . Ken

--
Upcoming XSLT/XSL-FO hands-on courses:      Wellington, NZ 2009-01
Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video
G. Ken Holman                 mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/s/
Male Cancer Awareness Nov'07  http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal

Current Thread