首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >从xsl-fo中的fo文件中删除特定区域

从xsl-fo中的fo文件中删除特定区域
EN

Stack Overflow用户
提问于 2020-07-07 13:50:30
回答 1查看 54关注 0票数 0

我有一个定义如下的xsl-fo文件,

代码语言:javascript
复制
<?xml version="1.0" encoding="utf-8" ?>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
  <fo:layout-master-set>
    <fo:simple-page-master master-name="master">
      <fo:region-body margin-bottom="0.5in" margin-top="0.9in" margin-left="35pt"/>
      <fo:region-before region-name="xsl-region-before" extent="0.9in"/>
      <fo:region-after region-name="xsl-region-after" extent="0.5in"/>
    </fo:simple-page-master>
  </fo:layout-master-set>
  <fo:page-sequence master-reference="master">
    
    <fo:static-content flow-name="xsl-region-before">
    Some not needed things will be here
    </fo:static-content>

    <fo:static-content flow-name="xsl-region-after">
    
    Some not needed things will be here
    
    </fo:static-content>

    <fo:flow flow-name="xsl-region-body">
      <fo:block font-size="10pt" xmlns:fo="http://www.w3.org/1999/XSL/Format">
  <fo:table table-layout="fixed" space-after="0pt" border-collapse="separate" border-separation="0pt">
// This is the content that I need
  </fo:table>
</fo:block>
      <fo:block id="end"/>
    </fo:flow>
  </fo:page-sequence>
</fo:root>

有没有什么方法可以删除在这个fo中定义的一些我不需要处理的区域?我想要做的是很好地去掉其中的<fo:static-content flow-name="xsl-region-after"><fo:static-content flow-name="xsl-region-before">。我怎么能做到这一点。会非常感谢你的帮助

EN

回答 1

Stack Overflow用户

发布于 2020-07-07 15:53:53

假设您有一个可用的XSLT处理器,您可以使用一个样式表,该样式表是一个标识模板加上一个优先级更高的模板,它会删除您不需要的元素:

代码语言:javascript
复制
<xsl:stylesheet
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    version="2.0"
    xmlns:fo="http://www.w3.org/1999/XSL/Format">

<xsl:template match="fo:static-content" />
 
<!-- Identity template. -->
<xsl:template match="@* | node()" mode="#all">
  <xsl:copy>
    <xsl:apply-templates select="@* | node()" mode="#current"/>
  </xsl:copy>
</xsl:template>

</xsl:stylesheet>
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/62768893

复制
相关文章

相似问题

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