Search code examples
xmlxsltxsl-foecrion

How to get a bullet point Black round circle instead of html code using XSLT


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>

Solution

  • 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 (•).