Search code examples
xsltxsl-foantenna-house

XSLT FO Horizontal alignment of inline container


I'm trying to align an inline container horizontally, but I can't find the corresponding FO attribute like display-align for vertical alignment.

Here is some example code without any alignment:

<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>

The whole thing is going to be processed with AntennaHouse 5.2.

Thanks in advance Stavros


Solution

  • 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