最后一页的XSL-FO页脚 [英] XSL-FO footer on last page

查看:81
本文介绍了最后一页的XSL-FO页脚的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有页眉和页脚的XSL-FO文件.

I have an XSL-FO file with a header and footer.

我为页眉和页脚添加了静态内容,但我希望页脚仅显示在最后一页上.

I added static content for the header and footer, but I want the footer to only display on the last page.

我该怎么做?

<?xml version="1.0" encoding="ISO-8859-1"?>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
    <fo:layout-master-set>
        <fo:simple-page-master master-name="A4" page-width="210mm" page-height="297mm" margin-top="1cm" margin-bottom="1cm"
                               margin-left="1cm" margin-right="1cm">
            <fo:region-body margin-top="90mm" margin-bottom="80mm"/>
            <fo:region-before extent="90mm"/>
            <fo:region-after extent="80mm"/>
            <fo:region-start/>
            <fo:region-end/>
        </fo:simple-page-master>
    </fo:layout-master-set>
    <fo:page-sequence master-reference="A4">
        <fo:static-content flow-name="xsl-region-before">
            <fo:block>
                <fo:external-graphic src="images/logo.png" content-width="scale-to-fit" height="50mm"/>
            </fo:block>
        </fo:static-content>
        <fo:static-content flow-name="xsl-region-after">
            <fo:block>
                <fo:external-graphic src="images/signature.gif" content-width="scale-to-fit" height="50mm"/>
            </fo:block>
        </fo:static-content>
        <fo:flow flow-name="xsl-region-body">
            ...
        </fo:flow>
    </fo:page-sequence>
</fo:root>

推荐答案

<fo:layout-master-set>内,您可以定义页面顺序:

Within <fo:layout-master-set>, you can define a page sequence:

<page-sequence-master master-name="pages">
  <repeatable-page-master-alternatives>
    <conditional-page-master-reference page-position="last" master-reference="last-page"/>
    <conditional-page-master-reference master-reference="other-page"/>
  </repeatable-page-master-alternatives>
</page-sequence-master>

然后,您可以为最后一个页面定义一个简单页面母版,该页面包含一个仅在此页面之后出现的区域.

Then you can define a simple-page-master for the last page, which contains a region-after that only appears on this page.

教程

这篇关于最后一页的XSL-FO页脚的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆