我正在使用 XSL FO 生成一个包含信息表的 PDF 文件。这些列之一是“描述”列。我填充这些描述字段之一的字符串示例如下:
This is an example Description.<br/>List item 1<br/>List item 2<br/>List item 3<br/>List item 4
在与此描述对应的表格单元格内,我希望输出显示如下:
This is an example Description.
List item 1
List item 2
List item 3
List item 4
我从其他地方的搜索中了解到,您可以在 XSL FO 中使用<fo:block></fo:block>
另一个<fo:block>
元素中的 an 进行换行。因此,甚至在我用我的 XSL 样式表解析 XML 之前,我都会替换所有出现的<br/>
with <fo:block/>
,因此字符串的文字值现在看起来像:
This is an example Description.<fo:block/>List item 1<fo:block/>List item 2<fo:block/>List item 3<fo:block/>List item 4
当我使用的描述字符串是使用 获取时,就会出现问题<xsl:value-of>
,示例如下:
<fo:block>
<xsl:value-of select="descriptionStr"/>
</fo:block>
在这种情况下,输出到我的 PDF 文档的值是文字值,因此它看起来与前面的示例完全一样,其中包含所有<fo:block/>
文字。我尝试<fo:block/>
在另一个字符串的中间手动硬编码,它显示正确。例如,如果我在样式表中写:
<fo:block>Te<fo:block/>st</fo:block>
它将正确显示为:
Te
st
但是,当 位于语句<fo:block/>
的值内时,这似乎不会发生。<xsl:value-of select=""/>
我试过在 SO 和 Google 等上搜索这个,但无济于事。任何建议或帮助将不胜感激。谢谢!