Search code examples
xmlapache-fopdocbookxslt

Emphasized text in docbook, fo, pdf out put


I am trying to emphasize a character of some static text to render into the footer of my pdf, but can't figure out the right combination of tags in my xsl. How can I accomplish this?

Example:

<!-- Footer content -->
<xsl:template name="footer.content">  
  <xsl:param name="pageclass" select="''"/>
  <xsl:param name="sequence" select="''"/>
  <xsl:param name="position" select="''"/>
  <xsl:param name="gentext-key" select="''"/>

<fo:block>
<xsl:choose>

...
<xsl:when test="$sequence = 'odd' and $position = 'left'">
        <xsl:text>&#x00A9;<emphasis>My</emphasis>Company</xsl:text>
</xsl:when>
...
</xsl:choose>
</fo:block>
</xsl:template>

This example generates an error in xsltproc. Help!


Solution

  • Try using fo:inline.

    I'm not sure what kind of emphasis you're trying to achieve or what kind of error you're getting, but try something like this:

    <!-- Footer content -->
    <xsl:template name="footer.content">  
      <xsl:param name="pageclass" select="''"/>
      <xsl:param name="sequence" select="''"/>
      <xsl:param name="position" select="''"/>
      <xsl:param name="gentext-key" select="''"/>
    
    <fo:block>
    <xsl:choose>
    
    ...
    <xsl:when test="$sequence = 'odd' and $position = 'left'">
            <xsl:text>&#x00A9;</xsl:text><fo:inline text-decoration="underline">My</fo:inline><xsl:text>Company</xsl:text>
    </xsl:when>
    ...
    </xsl:choose>
    </fo:block>
    

    Hope this helps.