0

Here's my code to select bullet types for different nested lists, but only the disc shows up in the PDF. How can I get a hollow circle and solid square symbol to show up?

<xsl:choose>
    <xsl:when test="parent::ul[ancestor::ul[ancestor::ul]]"><!--double nested bullet-->
        <xsl:attribute name="font-family">Times New Roman</xsl:attribute>
        <fo:character character="&#x25A0;"/><!--solid square-->
    </xsl:when>
    <xsl:when test="parent::ul[ancestor::ul]"><!--single nested bullet-->
        <xsl:attribute name="font-family">Times New Roman</xsl:attribute>
        <fo:character character="&#x2218;"/><!--hollow circle-->
    </xsl:when>
    <xsl:otherwise><!--bullet-->
        <xsl:attribute name="font-family">Times New Roman</xsl:attribute>
        <fo:character character="&#x2022;"/><!--disc-->
    </xsl:otherwise>
</xsl:choose>
Webucator
  • 2,397
  • 24
  • 39
  • Is your XML in a namespace? Do you need to use a qualified name for `ul`? – Tony Graham Jan 14 '20 at 14:34
  • No. It outputs fine. It just doesn’t output the characters. It’s a font / encoding issue. I would think there were standard symbols used to create bullets similar to the ones used on HTML pages for nested lists, but I can’t figure it out. – Webucator Jan 14 '20 at 14:57
  • 1
    Have you looked in the generated XSL-FO? If it was a font/encoding issue, then you would get the glyph for a missing character, not the default from your `xsl:choose`. Also, I checked, and `■` is present in Times New Roman (on my Windows 10, at least). – Tony Graham Jan 14 '20 at 15:42
  • The FO shows the actual glyphs. – Webucator Jan 14 '20 at 17:26
  • 1
    @TonyGraham's answer would presume you actually have also edited the xep.xml configuration to enable Time New Roman as a font. If you have not, it is why you are not getting the characters – Kevin Brown Jan 14 '20 at 21:03
  • @KevinBrown, I had, yet the glyphs were still not showing in the resulting PDF. I suspect I did have something wrong in the config file though or with where/how I was storing the font files. – Webucator Jan 15 '20 at 00:47

1 Answers1

0

I couldn't figure this out, so I just created png files for the glyphs, which is probably what I should have done in the first place. In case it's helpful to anyone else, here are the images I used:

Bullet 1 Bullet 2 Bullet 3

Here's a screenshot of the output:

PDF Output

And here's the new code:

<xsl:choose>
    <xsl:when test="parent::ol">
        <xsl:number format="1."/>
    </xsl:when>
    <xsl:when test="parent::ul[ancestor::ul[ancestor::ul]]"><!--double nested bullet-->
        <fo:external-graphic src="{$staticImages}bullet-level-3.png"/>
    </xsl:when>
    <xsl:when test="parent::ul[ancestor::ul]"><!--single nested bullet-->
        <fo:external-graphic src="{$staticImages}bullet-level-2.png"/>
    </xsl:when>
    <xsl:otherwise><!--bullet-->
        <fo:external-graphic src="{$staticImages}bullet-level-1.png"/>
    </xsl:otherwise>
</xsl:choose>
Webucator
  • 2,397
  • 24
  • 39