XSL-FO テーブル

XSL-FOは<fo:テーブルおよびキャプション>要素を使用してテーブルを定義します。

XSL-FO テーブル

XSL-FOのテーブルモデルはHTMLのテーブルモデルとは非常に異なります。

XSL-FOではテーブルを作成するために九種類のオブジェクトを使用できます:

  • fo:テーブルおよびキャプション
  • fo:テーブル
  • fo:テーブルキャプション
  • fo:テーブル列
  • fo:テーブルヘッダー
  • fo:テーブルフッター
  • fo:テーブルボディ
  • fo:テーブル行
  • fo:テーブルセル

XSL-FOは <fo:table-and-caption> 要素を使用してテーブルを定義します。それには、 <fo:table> およびオプションの <fo:キャプション> 要素。

<fo:table>要素は以下を含みます:

  • オプションの <fo:table-column> 要素を持ち得ます
  • オプションの <fo:table-header> 要素を持ち得ます
  • <fo:table-body> 要素を持ち得ます
  • オプションの <fo:table-footer> 要素を持ち得ます

これらの要素の各々は1つまたは複数の <fo:table-row> 要素が含まれますが、 <fo:table-row> 同時に1つまたは複数の <fo:table-cell> 要素:

<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">車</fo:block>
    </fo:table-cell>
    <fo:table-cell>
      <fo:block font-weight="bold">価格</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>

以下のコードの出力: