【问题标题】:Referencing elements in xsl-fo引用 xsl-fo 中的元素
【发布时间】:2011-07-04 16:21:58
【问题描述】:

是否可以在 xsl-fo 中“引用”元素?我想做的是以下几点:

<fo:marker marker-class-name="continued">
<!-- much much more xml text content -->
</fo:marker>

<--.....-->

<fo:table-body>
 <fo:table-row>
  <!--at his point I'd like to "reference" (or copy) the marker from above -->
 </fo:table-row>
 <!--many more rows which reference the same marker -->
</fo:table-body>

这样做的原因是,如果我的表中有很多行并且标记内容很大,那么 xml 就会变得太大。我已经尝试过 xsl:copy-of 元素,因为这看起来是我想要做的:

http://www.w3schools.com/xsl/el_copy-of.asp

但这不适用于我的 fo,显然元素的副本被忽略了,因为我在输出中没有得到任何表头。有任何想法吗?我正在使用 Ecrion 渲染器。

谢谢

斯蒂芬

【问题讨论】:

  • 您误解了 XSL-FO 的范围,它不接受 XSLT 语法。您可以编写一个生成 XSL-FO 的 XSLT,然后使用 XSLT 指令。否则,您必须在 XSL-FO 对象中搜索合适的元素。

标签: xslt xsl-fo


【解决方案1】:

尝试使用fo:retrieve-marker

例如:

<fo:marker marker-class-name="continued">
<!-- much much more xml text content -->
</fo:marker>

<--.....-->

<fo:table-body>
 <fo:table-row>
  <fo:retrieve-marker retrieve-class-name="continued" retrieve-position="first-including-carryover"/>
 </fo:table-row>
 <!--many more rows which reference the same marker -->
</fo:table-body>

【讨论】:

    猜你喜欢
    • 2010-11-08
    • 1970-01-01
    • 2017-06-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-09-12
    • 1970-01-01
    • 2015-12-22
    相关资源
    最近更新 更多