XSL-FO Tableaux


XSL-FO utilise l'élément <fo:table-and-caption> pour définir des tableaux.


Tableaux XSL-FO (tableaux)

Le modèle de tableau XSL-FO n'est pas entièrement différent du modèle de tableau HTML.

Il existe neuf objets XSL-FO utilisés pour créer des tableaux :

  • 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 utilise<fo:table-and-caption>élément pour définir un tableau. Il contient un <fo:table> et un<fo:caption> facultatifélément.

L'élément <fo:table> contient un<fo:table-column>élément facultatif, un<fo:table-header>élément facultatif, un<fo:table-body>élément, un<fo:table-footer>élément facultatif. Chacun de ces éléments peut contenir un ou plusieurs<fo:table-row>éléments, et<fo:table-row>contient également un ou plusieurs<fo:table-cell>éléments :

<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">Voiture</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block font-weight="bold">Prix</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>

La sortie du code ci-dessus est affichée ci-dessous :

Car Prix
Volvo $50000
SAAB $48000

Autres extensions