|
Subject: [xsl] Translating character entities for plain text output From: "Bradford, Denis" <denisb@xxxxxxxxxxxx> Date: Wed, 17 Jul 2002 13:17:50 -0400 |
I've found a lot of discussion in the archives about solving character
entity problems for HTML output, but not much on plain text:
Generating plain text from docbook via XSLT, I need to output a space for
and -- for —. I can get some funny glyphs (like  for )
and various literal codes, but not the result I want. I could postprocess
the output, but I'd love to fix the style sheet.
The XML document is encoded in utf-8 and resolves these characters through
the standard docbook entity files. Specifically, <!ENTITY nbsp " "> and
<!ENTITY mdash " & #x2014;">.
In the stylesheet, I've tried defining the entity in a local subset, also
html and text methods and various encodings in the xsl:output. The following
almost works:
<xsl:template match="text()">
<xsl:if test="contains(.,' ')">
<xsl:value-of select="translate(., ' ', ' ')"/>
</xsl:if>
</xsl:template>
Unfortunately, this seems to suppress another essential translation on the
same context:
<xsl:value-of select="translate(., '

', ' ')"/>
I can do either, but not both.
There must be a better way...
Thanks,
Denis
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| [xsl] ANN: free RenderX XEP for uni, David Tolpin | Thread | Re: [xsl] Translating character ent, David Carlisle |
| Re: [xsl] Creating Hierachial menu, Jeni Tennison | Date | [xsl] <xsl:choose>'ing from differe, xml |
| Month |