3

FOPを使用してHTML(XMLに埋め込まれている)をPDFに変換しています。HTMLスニペットは次のようになります:-

<table border="1" width="100%">
  <thead>
    <tr>
      <th>Name</th>
      <th>Value</th>
    </tr>
  </thead>
  <tbody/>
</table>

変換すると、次のエラーが発生します:-

Caused by: org.apache.fop.fo.ValidationException: Error(Unknown location): fo:table-body i
s missing child elements.
Required Content Model: marker* (table-row+|table-cell+)

要素を削除したときに同様のエラーが発生しました<tbody/>:-

org.apache.fop.fo.ValidationException: Error(Unknown location): fo:table is missing child
elements.
Required Content Model: (marker*,table-column*,table-header?,table-footer?,table-body+)

fo:tableにはtable-bodyが必要であり、table-bodyにはtable-rowが必要なようです。私の質問は:-

テーブルヘッダーのみでテーブル本体なし、または空のテーブル本体でテーブルを作成することは可能ですか?

4

2 に答える 2

0

もちろん、次の方法で行うことができます。

  1. を作成します<fo:table-body>
  2. <fo:table-cell必要な場合でもsを作成 する
  3. 境界線のサイズをゼロにして白、またはページの背景の色を入力します
于 2012-06-29T12:29:56.573 に答える
0

データのxpathがxpa/thの場合、次を使用できます。

<fo:table>
    <fo:table-header>(whatever)</fo:table-header>
    <fo:table-body>
        <xsl:if test="xpa/th">
            <xsl:apply-templates select="xpa/th" />
        </xsl:if>
        <xsl:if test="not(xpa/th)">
            <fo:table-cell><fo:block /></fo:table-cell>
        </xsl:if>
    </fo:table-body>
</fo:table>
于 2013-02-08T10:33:57.030 に答える