I would like to have dotted underline words using XSL-FO.
I am able to underline the words using a template but not make the line dotted.
Here is the template that I am using:
<xsl:template match="db:link">
<fo:inline font-family="AvenirNextLTPro-It" text-decoration="underline">
<fo:basic-link internal-destination="{@idref}">
<xsl:apply-templates/>
</fo:basic-link>
</fo:inline>
</xsl:template>
And this is how I apply it on my words:
<link idref="policy">Policy</link>
Is there a parameter to make dotted underlines in XSL-FO?
The values supported for text-decoration do not include anything for dotted lines:
none | [ [ underline | no-underline] || [ overline | no-overline ] || [ line-through | no-line-through ] || [ blink | no-blink ] ] | inherit
You may be able to get close to the desired affect via border-bottom-style:
<fo:inline font-family="AvenirNextLTPro-It" border-bottom-style="dotted">
Side note: Be sure to account for namespaces properly – your template is matching db:link yet the example you show is link. Depending on the default namespaces in play and the definition of the db namespace prefix, you may have a matching issue to address too.
Like this:
<fo:block>
<fo:inline>I do not have anything. </fo:inline>
<fo:inline border-bottom="0.5pt dotted black">Oh look! dotted underline! </fo:inline>
<fo:inline>No extensions required.</fo:inline>
<fo:inline border-bottom="0.5pt dotted black">And should work with any formatter! </fo:inline>
</fo:block>
Resulting in:

Tested with FOP, RenderX and AHF without any extensions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With