如果我在列表块中使用块容器,则会忽略Space-after

时间:2014-06-06 15:15:52

标签: xsl-fo

我有一个XML(用户手册),我尝试使用XSL-FO进行格式化。在手册中,我们使用的一种样式是List Note,它是列表的一部分(项目符号列表或编号列表)。例如:

  • 列出项目符号文本


    列出注释文本


音符有顶部和底部边框。我试图在音符的边框下面创建一些空间。

进入我的渲染器(Antennahouse)的组合FO文件如下所示:

<fo:list-item font-family="DIN-RegularAlternate" font-size="8pt" line-height="13pt" font-weight="normal" font-style="normal" space-before="2pt" space-after="2pt" keep-with-previous="10">
<fo:list-item-label end-indent="label-end()">
    <fo:block margin-left="0pt">-</fo:block>
</fo:list-item-label>
<fo:list-item-body start-indent="body-start()">
    <!--List Bullet-->
    <fo:block background-color="transparent" font-family="DIN-RegularAlternate" font-size="8pt" line-height="13pt" font-weight="normal" font-style="normal" space-before="2pt" space-after="2pt">List Bullet text
        </fo:block>
    <!--List Note-->
    <fo:block-container start-indent="10mm" border-bottom="0.75pt solid rgb-icc(34,73,146,#Separation, 'PANTONE 287 C', 100%)" border-top="0.75pt solid rgb-icc(34,73,146,#Separation, 'PANTONE 287 C', 100%)" keep-together.within-column="always" space-before="0pt" space-after="12pt">
        <fo:block background-color="transparent" font-family="DIN-RegularAlternate" font-size="7pt" line-height="13pt" font-style="italic" space-before="0pt" space-after="0pt" color="rgb-icc(0,0,0,#CMYK,0%,0%,0%,80%)" padding-top="3pt" padding-bottom="3pt" padding-left="0pt" padding-right="6pt" start-indent="0pt" end-indent="6pt">Note text
            </fo:block>
    </fo:block-container>
</fo:list-item-body>

块容器是List Note模板的一部分。我给这个块容器一个Space-below属性。但是我不能让它发挥作用:这个音符下面的空间固执地保持在0点。我尝试过使用各种属性:

space-after.minimum="12pt" space-after.optimum="12pt" space-after.precedence="force"

如果我将块容器移到list-block之外,我可以使它工作。但这是不受欢迎的,因为这种笔记样式必须在编号列表中可用;如果音符块在列表块之外,则列表的编号将重新开始。 我也可以在List Bullet下面找到一个漂亮的空间,它只是在这里给我带来麻烦的笔记。
我得出结论,列表块中的块容器的组合会导致麻烦。

如何控制音符边框下方的空间?

1 个答案:

答案 0 :(得分:0)

显然,只有当你有两个兄弟姐妹的时候,才会尊重space-after属性。我最后在list-block中添加了space-after:

<xsl:if test="(./para/@stylename='List Note') or (./para/@stylename='List Note 2')">
    <xsl:attribute name="space-after">6pt</xsl:attribute>
</xsl:if>

一位同事建议在我的原始代码中使用margin-bottom而不是space-after,因为margin-bottom在不是兄弟姐妹的块之间得到尊重。尽管如此,我还没有尝试过。