Apache FOP XSL/XSLT - 在生成的 PDF 中将文本设为粗体

use*_*040 1 xml apache xslt apache-fop

我有一个像这样的xml:

<?xml version="1.0" encoding="UTF-8"?>
<TermsAndConditions>
        <clause><clausetext>Terms and Conditions of Supply - Please read carefully</clausetext></clause>
        <clause><clausetext>Available only to <bold>customers who have an existing</bold> account.</clausetext></clause>
</TermsAndConditions>
Run Code Online (Sandbox Code Playgroud)

样式表是:

<fo:page-sequence master-reference="simple" >
        <fo:flow flow-name="xsl-region-body">       
        <xsl:for-each select="data/TermsAndConditions/clause">
                <fo:block font-size="10pt" font-family="Arial" color="#6d6e71"><xsl:value-of select="clausetext" />
</fo:block>
                <fo:block font-size="10pt" font-family="Arial" line-height="10pt" space-after.optimum="3pt" text-align="justify">&#0160;</fo:block>
        </xsl:for-each>
    </fo:flow>
</fo:page-sequence>
Run Code Online (Sandbox Code Playgroud)

如何在生成的 pdf 中将标签 <bold></bold> 之间的文本设置为粗体?目前我可以看到条款,但文字一切正常。

除此之外,我使用 w3schools.com 的 tryit 编辑器尝试了类似的操作:[ http://www.w3schools.com/xsl/tryxslt.asp?xmlfile=cdcatalog&xsltfile=tryxsl_if ]

具有以下样式表:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
  <html>
  <body>
     <xsl:apply-templates mode="tttt" />
  </body>
  </html>
</xsl:template>

  <xsl:template match="bold" mode="tttt">
     <b><xsl:value-of select="." /></b>
   </xsl:template>
</xsl:stylesheet>
Run Code Online (Sandbox Code Playgroud)

我得到了所需的输出。

Ste*_*gny 5

<b>是 html 语法,对于 fo 这可能应该是:

<xsl:template match="bold" mode="tttt">
     <fo:inline font-weight="bold"><xsl:value-of select="." /></fo:inline>
   </xsl:template>
</xsl:stylesheet>
Run Code Online (Sandbox Code Playgroud)