XSLT FO内联容器的水平对齐

时间:2016-04-01 13:09:53

标签: xslt xsl-fo

我正在尝试水平对齐内联容器,但我找不到相应的FO属性,例如display-align用于垂直对齐。

以下是一些没有任何对齐的示例代码:

<fo:inline-container background-color="white" border-style="solid" border-width="2mm" border-color="white">
    <fo:block font-family="Blablabla" text-align="center" font-size="54pt" space-after="6mm" text-indent="0mm" last-line-end-indent="0mm" alignment-baseline="central">
        ...
    </fo:block>
</fo:inline-container>

整件事将由AntennaHouse 5.2处理。

提前致谢 斯塔夫罗斯

1 个答案:

答案 0 :(得分:2)

Add text-align="center" to the fo:block (or similar) that contains the fo:inline-container:

 <fo:block text-align="center">
    <fo:inline-container background-color="white" border-style="solid" border-width="2mm" border-color="white">
      <fo:block font-family="Blablabla" text-align="center" font-size="54pt" space-after="6mm" text-indent="0mm" last-line-end-indent="0mm">
          ...
       </fo:block>
    </fo:inline-container>
 </fo:block>

Also, your alignment-baseline="central" doesn't do anything since alignment-baseline doesn't apply to fo:block and is not inherited. See https://www.w3.org/TR/xsl11/#alignment-baseline