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

[xsl] How do I preserve a &#xnnnn; character reference between transfor mations?


Subject: [xsl] How do I preserve a &#xnnnn; character reference between transfor mations?
From: Graham Hannington <Ghannington@xxxxxxx>
Date: Wed, 18 Dec 2002 22:10:05 -0000

I've read the Special Characters FAQ, and I'm still stumped.

I'm trying to insert a right-facing triangle into a PDF, using FOP.

First, I use one stylesheet to transfrom XHTML with class attributes into
XHTML without class attributes.
Second, I use another stylesheet (Xhtml2fo.xsl) to transform the previous
result into FO.
Third, I use FOP to convert the FOP into a PDF.

One thing I want to do in the first stylesheet is to transform this:

  <span class="symbol">|</span>

(yes, that's a vertical bar)

into this:

  &x#25B6;

(the UTF-8 right-facing triangle)

Both stylesheets specify:

  <?xml version='1.0' encoding="utf-8"?>

and

  <xsl:output method="xml" version="1.0" encoding="utf-8" indent="no"/>


I'm using MSXSL to perform the transforms.

I expect to be able to specify something like this:

  <xsl:template match="span[@class='symbol']">
    <xsl:choose>
      <xsl:when test="text()='|'">&#x25B6;</xsl:when>

    ...

    </xsl:choose>
  </xsl:template>

but, in the PDF, this produces a # (hash character) where the triangle
should be. And the output from the first stylesheet shows a single character
(I think a Greek "alpha" character) when I view it in Windows Notepad.

The second stylesheet successfully inserts &#x2022; (bullet) characters into
the FO, which appear correctly in the PDF.  How can I make the first
stylesheet insert &#x25B6; so that it also appears correctly in the eventual
PDF?

Graham Hannington

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



Current Thread
Keywords