html - 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>
编码真的不是我的工作,但我必须为工作做这个,所以如果你能有耐心并且非常非常清楚,那就太好了。谢谢!
解决方案
推荐阅读
- kotlin - 在分配时禁用换行符
- java - ITextRenderer 无法识别 xhtml 中定义的页面大小
- html - 是否可以通过 HelpNDoc API 使用 XML 和 HTML API 库?
- r - 连续字符值和时间大于指定间隔的情况
- parsing - 语法检查校对工具(插件、宏或你有什么)处理(一劳永逸)荷兰语 Word 文档中所谓的“dt-errors”
- mysql - 在 Sequelize(MySQL) 中,如何使用多个事务?
- python - 我将如何验证用户输入的密码与哈希密码表单数据库相同
- excel - 为什么保存共享文件时会创建重复的excel文件
- laravel - 我需要在 Laravel 中为数据库中已经存在的表创建迁移吗?
- python - 使用 tox 和 Github Action 访问环境变量