简体   繁体   English

如何在xsl-fo中的元素之后中断页面

[英]How break page after my element in xsl-fo

I use this code for apache xsl-fo: 我将此代码用于apache xsl-fo:

<xsl:template match="depFileNom">
        <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
            <fo:layout-master-set>
                <fo:simple-page-master margin-right="1cm"
                                     margin-left="2.7cm"
                                     margin-bottom="2cm"
                                     margin-top="2cm"
                                     page-width="21.5cm"
                                     page-height="29.7cm"
                                     master-name="first">
                    <fo:region-body margin-right="1cm" margin-left="0cm"/>
                </fo:simple-page-master>
            </fo:layout-master-set>
            <fo:static-content flow-name="xsl-after">
                <fo:block text-align="center" font-size="10pt"><fo:page-number /></fo:block>
            </fo:static-content>

            <fo:block font-family="Times" font-size="15pt">
                    <fo:table>
                        <fo:table-column column-width="10000px" text-align="left"/>
                        <fo:table-body>                       
                            <fo:table-row>
                                <fo:table-cell border-style='none' vertical-align='middle'><fo:block><xsl:apply-templates select="year" /> year</fo:block></fo:table-cell>
                            </fo:table-row>
                         </fo:table-body>
                    </fo:table>
I want to break here
...

I think need to use: 我认为需要使用:
page-break-before 分页符,前
page-break-after 分页,后
But i don't know how please help me 但我不知道请帮助我

It's hard to say for sure because your FO is incomplete, but try adding the attribute page-break-after="always" to the fo:block . 很难确定,因为你的FO不完整,但尝试将属性page-break-after="always"fo:block If you're trying to break after the fo:table , and there are following siblings in the same fo:block , try moving the page-break-after="always" to the fo:table . 如果你想在fo:table之后破解,并且在同一个fo:block有以下兄弟,请尝试将page-break-after="always"fo:table

Depending on your data, you may also want to consider using different fo:page-sequence 's for the different pieces of content. 根据您的数据,您可能还需要考虑对不同的内容使用不同的fo:page-sequence

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM