xsl:fo 检索标记不是有效的子项

2023-12-12

我需要进行 xsl:fo 转换<fo:retrieve-marker>在表中,但我不知道这是否可能,因为我使用 FOP 处理器进行转换。

如果我使用<fo:retrieve-marker>在我的表中,我总是收到一条错误消息,指出标签必须位于静态内容中。

这是带有标记的表格

                <xsl:call-template name="MMEL-Table-Header"/>

                <!-- Bottom table Line  -->
                <fo:table-footer>
                    <fo:table-row>
                        <fo:table-cell>                                                                             
                            <fo:marker marker-class-name="footer-continued"> <fo:inline>(continued)</fo:inline></fo:marker>
                        </fo:table-cell>
                    </fo:table-row>

                </fo:table-footer>

                <fo:table-body >               

                    <xsl:variable name="identification">
                        <xsl:value-of select="ident/message"/>                                 
                    </xsl:variable>                       
                    <xsl:apply-templates select="ident"><xsl:with-param name="ident" select="$identification"/></xsl:apply-templates>
                    <xsl:apply-templates select="provisos/proviso"><xsl:with-param name="ident" select="$identification"/></xsl:apply-templates>

                <fo:table-row>
                    <fo:table-cell> <fo:retrieve-marker retrieve-position="first-starting-within-page" retrieve-class-name="footer-continued" retrieve-boundary="document" /> </fo:table-cell>
                </fo:table-row>
                </fo:table-body>           
            </fo:table>          

(披露:我是一名 FOP 开发人员)

此示例具有动态表头和表脚,因此它应该满足您的要求:

  • 如果表格适合一页,则表格页眉和表格页脚均为空
  • if the table is split over several pages
    • 表头为空first页,在下面的页中显示“(续)”
    • 表页脚为空last页,在前面的页中,它显示“(下一页继续)”
  • 使用 FOP 2.0 进行测试(旧版本did not支持表格标记);由于 FOP 目前的限制,不间断空格 &#x00A0;表头和表脚中是必要的“占位符”(表头/表脚尺寸仅计算一次,没有标记内容)
  • 没有特定于格式化程序的扩展,因此这也可以与其他格式化程序一起使用(Xsl格式化程序支持表格标记; XEP 有替代解决方法)

FO片段:

  <fo:table table-layout="fixed" width="100%">
    <fo:table-column column-width="100%"/>
    <fo:table-header>
      <fo:table-row>
        <fo:table-cell>
          <fo:block>
            <fo:retrieve-table-marker retrieve-class-name="mc1" 
                retrieve-position-within-table="first-starting" 
                retrieve-boundary-within-table="table-fragment"/>
            &#x00A0;
          </fo:block>
        </fo:table-cell>
      </fo:table-row>
    </fo:table-header>
    <fo:table-footer>
      <fo:table-row>
        <fo:table-cell>
          <fo:block>
            <fo:retrieve-table-marker retrieve-class-name="mc2" 
                retrieve-position-within-table="last-ending" 
                retrieve-boundary-within-table="table-fragment"/>
            &#x00A0;
          </fo:block>
        </fo:table-cell>
      </fo:table-row>
    </fo:table-footer>
    <fo:table-body>
      <!-- first row -->
      <fo:table-row>
        <fo:table-cell>
          <fo:block>
            <fo:marker marker-class-name="mc1"></fo:marker>
            <fo:marker marker-class-name="mc2">(continues on the next page)</fo:marker>
            cell1
          </fo:block>
        </fo:table-cell>
      </fo:table-row>
      <!-- middle row -->
      <fo:table-row>
        <fo:table-cell>
          <fo:block>
            <fo:marker marker-class-name="mc1">(continued)</fo:marker>
            <fo:marker marker-class-name="mc2">(continues on the next page)</fo:marker>
            cell2
          </fo:block>
        </fo:table-cell>
      </fo:table-row>
      <!-- ... other similar rows ... -->
      <!-- last row -->
      <fo:table-row>
        <fo:table-cell>
          <fo:block>
            <fo:marker marker-class-name="mc1">(continued)</fo:marker>
            <fo:marker marker-class-name="mc2"></fo:marker>
            cell9
          </fo:block>
        </fo:table-cell>
      </fo:table-row>
    </fo:table-body>
  </fo:table>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

xsl:fo 检索标记不是有效的子项 的相关文章

随机推荐