XSL-FOでPDFドキュメントを生成していて、複数のページにまたがることがあるテーブルがあります。そのような場合、私がしたいのは、最初のページ以外のすべてのページに "(続き)"ラベルを付けて、新しいページが始まるときにテーブルのヘッダーを繰り返すことです。 XSL-FOテーブルのヘッダーを続ける
は私のXSLコード:<xsl:template name="Tooling">
<fo:table xsl:use-attribute-sets="tableDefaultLayout">
<fo:table-column column-width="37mm" />
<fo:table-column column-width="37mm" />
<fo:table-column column-width="74mm" />
<fo:table-column column-width="37mm" />
<fo:table-header xsl:use-attribute-sets="categoryDefaultFont">
<fo:table-row height="7.7mm" border="0pt solid black" display-align="before" text-align="start">
<fo:table-cell number-columns-spanned="4" font-size="12pt">
<fo:block margin-top="3mm">
<fo:retrieve-table-marker retrieve-class-name="continued"
retrieve-position-within-table="first-starting"
retrieve-boundary-within-table="table-fragment"/>
 
</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row xsl:use-attribute-sets="defaultBodyRow" height="4.7mm" border="0pt solid black">
<fo:table-cell>
<fo:block>
<xsl:text>Item No.</xsl:text>
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>
<xsl:text>Part No.</xsl:text>
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>
<xsl:text>Description</xsl:text>
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>
<xsl:text>Qty Reqd</xsl:text>
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-header>
<fo:table-body xsl:use-attribute-sets="valueDefaultFont" font-size="8pt">
<xsl:for-each select="1 to 50">
<fo:table-row xsl:use-attribute-sets="defaultBodyRow" border="0pt solid black">
<fo:table-cell>
<fo:block>
<xsl:choose>
<xsl:when test="position()=1">
<fo:marker marker-class-name="continued">
<xsl:text>TOOLING:-</xsl:text>
</fo:marker>
</xsl:when>
<xsl:otherwise>
<fo:marker marker-class-name="continued">
<xsl:text>TOOLING: (continued)</xsl:text>
</fo:marker>
</xsl:otherwise>
</xsl:choose>
<xsl:text>[email protected]</xsl:text>
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>
<xsl:text>[email protected]</xsl:text>
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>
<xsl:text>[email protected]ESC</xsl:text>
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>
<xsl:text>[email protected]</xsl:text>
</fo:block>
</fo:table-cell>
</fo:table-row>
</xsl:for-each>
</fo:table-body>
</fo:table>
</xsl:template>
そしてFOが生成:
<fo:table border-bottom="0.5pt solid black" border-collapse="collapse" border-left="1pt solid black" border-right="1pt solid black" border-top="0.5pt solid black" margin="0mm" padding="0mm" table-layout="fixed" width="100%">
<fo:table-column column-width="37mm"/>
<fo:table-column column-width="37mm"/>
<fo:table-column column-width="74mm"/>
<fo:table-column column-width="37mm"/>
<fo:table-header font-family="sans-serif" font-size="10pt" font-weight="bold">
<fo:table-row border="0pt solid black" display-align="before" height="7.7mm" text-align="start">
<fo:table-cell font-size="12pt" number-columns-spanned="4">
<fo:block margin-top="3mm">
<fo:retrieve-table-marker retrieve-boundary-within-table="table-fragment" retrieve-class-name="continued" retrieve-position-within-table="first-starting"/>
</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row border="0pt solid black" display-align="center" height="4.7mm" keep-together.within-page="always" text-align="center">
<fo:table-cell>
<fo:block>Item No.</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>Part No.</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>Description</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>Qty Reqd</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-header>
<fo:table-body font-family="monospace" font-size="8pt" font-weight="normal">
<fo:table-row border="0pt solid black" display-align="center" height="7.74mm" keep-together.within-page="always" text-align="center">
<fo:table-cell>
<fo:block>
<fo:marker marker-class-name="continued">TOOLING:-</fo:marker>[email protected]</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>[email protected]</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>[email protected]</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>[email protected]</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row border="0pt solid black" display-align="center" height="7.74mm" keep-together.within-page="always" text-align="center">
<fo:table-cell>
<fo:block>
<fo:marker marker-class-name="continued">TOOLING: (continued)</fo:marker>[email protected]</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>[email protected]</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>[email protected]</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>[email protected]</fo:block>
</fo:table-cell>
</fo:table-row>
はその後50行継続:あなたが最初のものはマーカーを持っている "TOOLING: - " 見ることができるようにし、すべての他には「ツール:(続き)」というマーカーがあります。これは私が望むものです。
私の問題は、fo:retrieve-table-markerオブジェクトを正しく動作させることができないということです。「retrieve-position」属性と「retrieve-boundary」属性で複数の組み合わせを試みましたが、私のヘッダーの最初の行は、最初または他のページで常に空白です。
「fo:retrieve-table-marker」オブジェクトと「fo:marker」オブジェクトで間違っていることを誰かが私に説明することができれば、本当の助けになるでしょう。私はこの問題に苦労しています今の数日間。
私はしばらく前に同様の問題があった(前にマーカーを取得しよう最初のfo:markerの出現)、最初の検索マーカーの前に余分なfo:markerのインスタンスを置くことで回避しました。しかし、それはうまくいくはずはありません。 – Hobbes
'table-omit-header-at-break =" true "'を設定しました。マーカーは表ヘッダーでのみ使用できるので、表ヘッダーの表示を要求しない場合は、** Continued **は表示されません。それ以外のコードは正しいです。 – potame
申し訳ありませんが、 "table-omit-header-at-break"はコピー/ペーストエラーです。この属性を追加して、実際に何が起こったのかを確認しようとしましたが、 @Hobbesはヒントありがとう、私はこれを試してみる – eipiplusun