I didn’t know about the extension
and -Dencoding.windows-1252=com.nwalsh.saxon.Windows1252 thing and had ended up
adding ndash, mdash, ldquo, rdquo, lsquo, and rsquo to my customization layer. Here’s
the template in case you want to punt like I did :-)
David
<xsl:template
name="escape-attr">
<xsl:param
name="value"/>
<xsl:variable
name="quote.char">'</xsl:variable>
<xsl:variable
name="amp.escaped">
<xsl:call-template
name="string.subst">
<xsl:with-param name="string" select="$value"/>
<xsl:with-param name="target" select="'&'"/>
<xsl:with-param name="replacement"
select="'&amp;'"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable
name="quot.escaped">
<xsl:call-template
name="string.subst">
<xsl:with-param name="string" select="$amp.escaped"/>
<xsl:with-param name="target" select="'"'"/>
<xsl:with-param name="replacement"
select="'&quot;'"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable
name="angle.escaped">
<xsl:call-template
name="string.subst">
<xsl:with-param
name="string" select="$quot.escaped"/>
<xsl:with-param name="target" select="'<'"/>
<xsl:with-param name="replacement"
select="'&lt;'"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable
name="ndash.escaped">
<xsl:call-template
name="string.subst">
<xsl:with-param name="string"
select="$angle.escaped"/>
<xsl:with-param name="target"
select="'–'"/>
<xsl:with-param name="replacement" select="'-'"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable
name="mdash.escaped">
<xsl:call-template
name="string.subst">
<xsl:with-param name="string"
select="$ndash.escaped"/>
<xsl:with-param name="target"
select="'—'"/>
<xsl:with-param name="replacement" select="'-'"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable
name="lsquo.escaped">
<xsl:call-template
name="string.subst">
<xsl:with-param name="string"
select="$mdash.escaped"/>
<xsl:with-param name="target"
select="'‘'"/>
<xsl:with-param name="replacement"
select="$quote.char"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable
name="rsquo.escaped">
<xsl:call-template
name="string.subst">
<xsl:with-param name="string"
select="$lsquo.escaped"/>
<xsl:with-param
name="target" select="'’'"/>
<xsl:with-param name="replacement"
select="$quote.char"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable
name="ldquo.escaped">
<xsl:call-template
name="string.subst">
<xsl:with-param
name="string" select="$rsquo.escaped"/>
<xsl:with-param name="target"
select="'“'"/>
<xsl:with-param name="replacement"
select="'&quot;'"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable
name="rdquo.escaped">
<xsl:call-template
name="string.subst">
<xsl:with-param name="string"
select="$ldquo.escaped"/>
<xsl:with-param name="target"
select="'”'"/>
<xsl:with-param name="replacement"
select="'&quot;'"/>
</xsl:call-template>
</xsl:variable>
<xsl:value-of
select="$rdquo.escaped"/>
</xsl:template>
From: Bob Stayton
[mailto:]
Sent: Thursday, February 09, 2006
4:57 PM
To: Joy Andree;
Subject: Re: [docbook-apps]
escaping characters in toc.hhc
The problem is that the default output encoding for
htmlhelp is iso-8859-1 and those characters are not in that encoding. But
you can use windows-1252 for the encoding with Saxon. See the
"Languages and Encoding" section of this reference:
http://www.sagehill.net/docbookxsl/HtmlHelp.html
You have to follow the directions and example very carefully for Saxon
processing with encoding="windows-1252", but it does work.
Bob Stayton
Sagehill Enterprises
DocBook Consulting
----- Original Message -----
From: Joy Andree
To:
Sent: Thursday, February 09, 2006 10:30 AM
Subject: [docbook-apps] escaping characters in toc.hhc
Help,
Here is the error I keep getting when a special character is in a title
element.
Error at xsl:copy-of on line 338 of
file:/D:/Tools/XSL/docbook/html/chunker.xsl:
Output character not available in this encoding (decimal 8220)
Transformation failed: Run-time errors were reported
This in turns breaks the toc.hhc file and the index. When the CHM is
opened the left side toc has only a path the location where the toc broke (even
thou other files build they are not displayed in the toc), which is not
necessarily the title with the special character. When I remove the
special character everything is fine and when I add it to the escape-attr.
My source xml has the “ and ”. I tried to modify by
creating a customization that changes the dingbat key to quot and changing the
saxon.character.representation to native but neither seems to work.
Other than adding each of these special characters to the escape-attr template
is there another way I can get the special characters to convert to the entity
instead of the decimal characters?
Thanks in advance,
Joy