首页 > 解决方案 > HTML 到格式化对象的转换

问题描述

这是我的 XML 输出示例(我无法更改,因为它是由我无法控制的 CRM 软件输出的):

<description><div><strong>Why</strong> is this not bold?</div> </description>

标签是正确的<description>xml 标签,而<div><strong>在 pdf 中作为纯文本输出(参见图片) pdf 输出

我试图让它们正确呈现并在线找到这篇文章https://www.ibm.com/developerworks/library/x-xslfo2app/index.html但不幸的是,下载不再可用。谁能向我解释如何将文章中提供的模板应用到我的 XSLT 文件中?

提供的代码段的 XSLT 目前是这样的:

<fo:table margin-bottom="10mm">
            <fo:table-column column-width="100%"/>
                <fo:table-body>
                  <fo:table-row>
                    <fo:table-cell xsl:use-attribute-sets="testBorderLeft">
                      <fo:block font-weight="bold">Detailed Description</fo:block>
                    </fo:table-cell>
                  </fo:table-row>
                  <fo:table-row>
                    <fo:table-cell xsl:use-attribute-sets="testBorderLeft">
                      <fo:block>
                        <xsl:value-of select="/hash/description"/>
                      </fo:block>
                    </fo:table-cell>
                  </fo:table-row>
                </fo:table-body>
        </fo:table>

例如,如何合并这个?

<xsl:template match="strong">
  <fo:inline font-weight="bold">
    <xsl:apply-templates select="*|text()"/>
  </fo:inline>
</xsl:template>

编码真的不是我的工作,但我必须为工作做这个,所以如果你能有耐心并且非常非常清楚,那就太好了。谢谢!

标签: htmlxmlxsltxslt-1.0

解决方案


推荐阅读