-1

I have a simple xslt that transforms an xml to an xsl-fo but when my xml is generated it produces bullet points in

•

when I use my transformation to transform to xsl-fo and pass that to ecrion to render a pdf it does not recognise the html code for bullet point I would like to add some condition to my XSLT to change that to a full black circle bullet point any suggestion please

 <?xml version="1.0"?>
 <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" omit-xml-declaration="yes" indent="yes" />

<xsl:template match="/doc">
<Generic><xsl:apply-templates /></Generic>
</xsl:template>

<xsl:template match="*|@*">
<xsl:copy>
  <xsl:apply-templates select="@*" />
  <xsl:apply-templates />
</xsl:copy>
</xsl:template>

<xsl:template match="&#149;">
<xsl:copy>
  <xsl:apply-templates select="•" />
  <xsl:apply-templates />
 </xsl:copy>
</xsl:template>
</xsl:transform>
Tony Graham
  • 7,306
  • 13
  • 20
Tim
  • 206
  • 6
  • 16

2 Answers2

1

Without seeing your XML input and the expected output, we can only guess. Try perhaps:

XSLT 1.0

<xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:strip-space elements="*"/>

<!-- identity transform -->
<xsl:template match="@*|node()">
    <xsl:copy>
        <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
</xsl:template>

<xsl:template match="/doc">
    <Generic>
        <xsl:apply-templates />
    </Generic>
</xsl:template>

<xsl:template match="text()">
    <xsl:value-of select="translate(., '&#149;', '&#8226;')" />
</xsl:template>

</xsl:stylesheet>

This will replace all occurrences of the MESSAGE WAITING control character (•) with the BULLET character (•).

michael.hor257k
  • 113,275
  • 6
  • 33
  • 51
0

Your source is in 'Windows-1252' encoding (or a similar Windows 'code page'). See, e.g., https://superuser.com/questions/1164809/whats-is-the-different-beween-western-european-windows-1252-and-ansi-encoding#1164814 and https://en.wikipedia.org/wiki/Windows-1252 to which it refers.

You would not need the text() template and the translate() if you could do one of these things:

  • Generate your XML in UTF-8 (or UTF-16) instead of in Windows-1252
  • Generate or modify the XML declaration at the start of your document so that it identifies the encoding as Windows-1252 (and use an XML processor that understands Windows-1252)
  • Use an XSLT processor, such as xsltproc, that lets you specify the encoding of the input document
  • Convert your Windows-1252 XML into UTF-8 using iconv (https://en.wikipedia.org/wiki/Iconv) or similar (and, post-conversion, delete or modify the XML declaration if it does, in fact, identify the encoding as Windows-1252)
Tony Graham
  • 7,306
  • 13
  • 20