xsl-foapache-fopxslt-3.0

Padding at top of fo:table-row


I'm using Apache FOP v2.9, with Saxon HE v12.3 & XSLT Version 3.0 under JDK v17.

I'm trying to specify Padding at the Row level of a Table.

According to the docs this should work, but the Padding is being ignored:

I use Data2Type's reference, as its easy to understand & normally very accurate, but in this case obviously not:
https://www.data2type.de/xml-xslt-xslfo/xsl-fo/xslfo-referenz/attribute/padding-top
(I'm afraid their Reference is only available in German)

<xsl:template match="OrderLines">
    <fo:table table-layout="fixed" width="100%" border="solid 1pt">
        <fo:table-column column-width="18mm"/>
        <fo:table-column/>
        <fo:table-body>
            <xsl:for-each select="OrderLine">
                <fo:table-row         padding-top="15pt">
                    <fo:table-cell>
                        <fo:block>SKU</fo:block>
                    </fo:table-cell>
                    <fo:table-cell>
                        <fo:block>Qty</fo:block>
                    </fo:table-cell>
                </fo:table-row>
            </xsl:for-each>
        </fo:table-body>
    </fo:table>
</xsl:template>

This works fine:

<xsl:template match="OrderLines">
    <fo:table table-layout="fixed" width="100%" border="solid 1pt">
        <fo:table-column column-width="18mm"/>
        <fo:table-column/>
        <fo:table-body>
            <xsl:for-each select="OrderLine">
                <fo:table-row>
                    <fo:table-cell         padding-top="15pt">
                        <fo:block>SKU</fo:block>
                    </fo:table-cell>
                    <fo:table-cell         padding-top="15pt">
                        <fo:block>Qty</fo:block>
                    </fo:table-cell>
                </fo:table-row>
            </xsl:for-each>
        </fo:table-body>
    </fo:table>
</xsl:template>

Any ideas, anyone?

The generated FO (excerpt) looks like this:

<fo:table-row padding-top="15pt">
    <fo:table-cell>
        <fo:block>SKU</fo:block>
    </fo:table-cell>
    <fo:table-cell>
        <fo:block>Qty</fo:block>
    </fo:table-cell>
</fo:table-row>

Solution

  • padding-top and other padding properties do not apply to fo:table-row.

    The definition of fo:table-row at https://www.w3.org/TR/xsl11/#fo_table-row does list the "Common Border, Padding, and Background Properties" as applying to fo:table-row, but that's immediately followed by a note stating that only the background properties apply, plus the border properties if border-collapse on the fo:table is collapse or collapse-with-precedence. There's no allowance for the padding properties.

    fo:table-row isn't listed with padding-top in the "Properties and the FOs they apply to" appendix section at https://www.w3.org/TR/xsl11/#prapply