首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >xsl:fo检索-标记无效子

xsl:fo检索-标记无效子
EN

Stack Overflow用户
提问于 2015-06-22 08:10:00
回答 1查看 2.1K关注 0票数 2

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

如果我在表中使用<fo:retrieve-marker>,我总是会收到一个错误消息,即标记必须位于静态内容中。

这是带有标记的表

代码语言:javascript
复制
                <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>          
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-06-23 19:45:06

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

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

  • 如果表适合单个页面,则表页眉和表页脚都为空。
  • 如果将表拆分成几个页面,则为
    • 表头对于第一个页是空的,在下面的页中它是“(续)”
    • 表页脚对于上一页页是空的,在前一页中它说“(在下一页继续)”。

  • 使用FOP2.0进行测试(旧版本不支持表标记);由于FOP当前的限制,表页眉和表页脚中的非中断空间&#x00A0;是必要的“占位符”(页眉/页脚尺寸只计算一次,没有标记内容)。
  • 没有特定于格式化程序的扩展,所以这也可以与其他格式化程序一起工作(XslFormatter支持表标记;XEP有替代的解决方案)

FO片段:

代码语言:javascript
复制
  <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>
票数 5
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/30974903

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档