Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

XSL-FO form


May 28, 2021 XSL-FO


Table of contents


XSL-FO form

This section will introduce you to the XSL-FO form.


XSL-FO defines tables using the elements of the .lt;fo:table-and-caption.


XSL-FO Form (Tables)

The XSL-FO table model is not completely different from the HTML table model.

There are nine XSL-FO objects that you can use to create tables:

  • fo:table-and-caption
  • fo:table
  • fo:table-caption
  • fo:table-column
  • fo:table-header
  • fo:table-footer
  • fo:table-body
  • fo:table-row
  • fo:table-cell

XSL-FO defines tables using the elements of the .lt;fo:table-and-caption. It contains an optional .lt;fo:table and an optional .lt;fo:caption.gt; element.

The element contains an optional .lt;fo:table-column> element, an optional .lt;fo:table-header?gt; an .lt;fo:table-body-gt; element; an optional .lt;fo:table-footer?gt; element. Each of these elements may have one or more of the elements, while the same time has one or more of the elements:

<fo:table-and-caption>
<fo:table>
<fo:table-column column-width="25mm"/>
<fo:table-column column-width="25mm"/>

<fo:table-header>
<fo:table-row>
<fo:table-cell>
<fo:block font-weight="bold">Car</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block font-weight="bold">Price</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-header>

<fo:table-body>
<fo:table-row>
<fo:table-cell>
<fo:block>Volvo</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>$50000</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell>
<fo:block>SAAB</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>$48000</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>

</fo:table>
</fo:table-and-caption>

The output of the above code looks like this:

Car Price
Volvo $50000
SAAB $48000

Related articles

HTML tables