表格连接2

<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
  <fo:layout-master-set>
    <fo:simple-page-master master-name="page" page-height="297mm" page-width="210mm">
      <fo:region-body margin-top="20mm" margin-bottom="20mm" margin-left="20mm" margin-right="20mm"/>
    </fo:simple-page-master>
  </fo:layout-master-set>
 
  <!-- 第一个表格 -->
  <fo:page-sequence master-reference="page">
    <fo:flow flow-name="xsl-region-body">
      <fo:table border-collapse="collapse">
        <fo:table-column column-width="proportional-column-width(1)"/>
        <fo:table-body>
          <!-- 第一个表格内容 -->
          <fo:table-row>
            <fo:table-cell>
              <fo:block>Row 1 of Table 1</fo:block>
            </fo:table-cell>
          </fo:table-row>
          <!-- 继续添加第一个表格的行,直至翻页 -->
          <!-- ... -->
          <fo:table-row>
            <fo:table-cell>
              <fo:block>Row N of Table 1</fo:block>
            </fo:table-cell>
          </fo:table-row>
        </fo:table-body>
      </fo:table>
    </fo:flow>
  </fo:page-sequence>
 
  <!-- 添加分页控制 -->
  <fo:page-sequence master-reference="page" force-page-count="no-force">
    <fo:flow flow-name="xsl-region-body">
      <!-- 使用条件渲染,只在第一个表格最后一页渲染第二个表格 -->
      <xsl:if test="not(//fo:table) and preceding::fo:page-sequence[last()]/fo:flow/fo:table">
        <!-- 第二个表格内容 -->
        <fo:table border-collapse="collapse">
          <fo:table-column column-width="proportional-column-width(1)"/>
          <fo:table-body>
            <fo:table-row>
              <fo:table-cell>
                <fo:block>Row 1 of Table 2</fo:block>
              </fo:table-cell>
            </fo:table-row>
            <!-- 继续添加第二个表格的行 -->
            <!-- ... -->
            <fo:table-row>
              <fo:table-cell>
                <fo:block>Row M of Table 2</fo:block>
              </fo:table-cell>
            </fo:table-row>
          </fo:table-body>
        </fo:table>
      </xsl:if>
    </fo:flow>
  </fo:page-sequence>
</fo:root>
 
posted @ 2023-07-20 22:22  OUKIN  阅读(14)  评论(0)    收藏  举报