2016-11-16 95 views
1

我无法使用DITA-OT PDF2剥离FOP内联元素中的空格。这是我的代码片段:在FOP内联元素中删除空格

<p>1 BEFORE <uicontrol>test</uicontrol> AFTER</p> 
<p>2 BEFORE <uicontrol> test</uicontrol> AFTER</p> 
<p>3 BEFORE <uicontrol>test </uicontrol> AFTER</p> 
<p>4 BEFORE <uicontrol><keyword keyref="test"/> </uicontrol> AFTER</p> 
<p>5 BEFORE <uicontrol> <keyword keyref="test"/></uicontrol> AFTER</p> 
<p>6 BEFORE <uicontrol> 
    <keyword keyref="test"/> 
</uicontrol> AFTER</p> 
<p>7 BEFORE <uicontrol> 
    <keyword keyref="test"/> 
</uicontrol> AFTER</p> 

渲染到:

这是我的属性设置:

<xsl:attribute-set name="uicontrol"> 
    <xsl:attribute name="white-space">nowrap</xsl:attribute> 
    <xsl:attribute name="white-space-treatment">ignore</xsl:attribute> 
    <xsl:attribute name="white-space-collapse">true</xsl:attribute> 
    <xsl:attribute name="linefeed-treatment">treat-as-zero-width-space</xsl:attribute> 
    <xsl:attribute name="background-color">#ff0000</xsl:attribute> 
</xsl:attribute-set> 

所有红色的空格都被剥离。我的错误在哪里?

回答

1

FOP似乎在“空白处理”难度:

XSL-FO Property Support Table (§7)

因此,它可能需要使用< XSL:带状空间元素=“uicontrol” >加正常化空间()在uicontrol中的text()函数。

以下是结果指定< XSL时:带状空间元素= “uicontrol” >

After applying xsl:strip-space

为了便于参考,天线房屋呈现原始的样式定义如下:

AHF render result

希望这有助于您的发展。

+0

非常感谢。 ''搞定了 –