我在XSL
样式表中得到了以下代码:
<xsl:for-each select="report:column-names/report:column">
<fo:table-cell display-align="center" font-size="9pt">
<fo:block font-family="{$font.family}" font-weight="bold">
<xsl:value-of select="." disable-output-escaping="yes" /> <--problematic value
</fo:block>
</fo:table-cell>
</xsl:for-each>
在我提到的有问题的值中,我得到了要用bdi
html标记包装的值。
我试着只放bdi
,但我没有看到我的价值,就像这样:
<bdi><xsl:value-of select="." disable-output-escaping="yes" /></bdi>
如何将此标记应用于我的值?
不能混合HTML和XSL-FO。XSL-FO是为格式化而定义的XML词汇表。XSLT最初的目的是将任意XML词汇表(毕竟"XML"中的"X"来自"可扩展")转换为标准格式词汇表。这就是您在问题中对XSLT所做的操作。
XSL 1.1中Unicode BIDI处理的说明位于https://www.w3.org/TR/xsl11/#d0e4879.适用的FO为fo:bidi-override
(https://www.w3.org/TR/xsl11/#fo_bidi-override),并且适用的属性为direction
(https://www.w3.org/TR/xsl11/#direction)和unicode-bidi
(https://www.w3.org/TR/xsl11/#unicode-bidi)。
到目前为止,您还没有显示report:column
元素的内容,但看起来您想要:
<fo:bidi-override unicode-bidi="embed" direction="rtl">
<xsl:value-of select="." disable-output-escaping="yes" />
</fo:bidi-override>
在没有看到report:column
元素的情况下,embed
和rtl
只是猜测。
(使用disable-output-escaping
很少是一个好主意,但在这种情况下,如果没有看到需要它的report:column
元素,我们就看不出它有多糟糕。)