0

Here the clean code:

<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
    <fo:layout-master-set>
        <fo:simple-page-master
                master-name="pages-normale"
                page-width="297mm"
                page-height="210mm"
                margin-top="0.5cm"
                margin-bottom="0.5cm"
                margin-left="0.5cm"
                margin-right="0.5cm">
            <fo:region-body   margin-top="1cm" margin-bottom="1cm"/>
            <fo:region-before margin-top="1cm" margin-bottom="1cm" extent="7cm"/>
            <fo:region-after  margin-top="1cm" margin-bottom="1cm" extent="1cm"/>
        </fo:simple-page-master>
    </fo:layout-master-set>
    <fo:page-sequence
            master-reference="pages-normale"
            initial-page-number="1"
            force-page-count="even"
            language="it"
            country="it">
        <fo:static-content flow-name="xsl-region-before">
            <fo:block>
                <fo:table  width="100%" border-width="0.5mm" margin-bottom="4mm" border-style="transparent">
                    <fo:table-column  column-width="50%"/>
                    <fo:table-column  column-width="50%"/>
                    <fo:table-header>
                        <fo:table-row>
                            <fo:table-cell border-style="normal">
                                <fo:block font-size="15" font-style="oblique" font-weight="bold">

                                </fo:block>
                            </fo:table-cell>
                            <fo:table-cell border-style="normal">
                                <fo:block font-size="8" font-weight="normal" text-align="right"/>
                            </fo:table-cell>
                        </fo:table-row>
                    </fo:table-header>
                    <fo:table-body>
                        <fo:table-row>
                            <fo:table-cell border-style="transparent">
                                <fo:block>
                                    <fo:block font-size="8" text-align="left" font-weight="normal" >
                                    </fo:block>
                                </fo:block>
                            </fo:table-cell>
                            <fo:table-cell border-style="transparent">
                                <fo:block>
                                    <fo:block font-size="8" text-align="left" font-weight="normal" >
                                    </fo:block>
                                </fo:block>
                            </fo:table-cell>
                        </fo:table-row>             
                    </fo:table-body>
                </fo:table>
            </fo:block>
        </fo:static-content>
        <fo:static-content flow-name="xsl-region-after">
            <fo:block>
                <xsl:value-of select="intestazione2_1/cliente3"/>
            </fo:block>
        </fo:static-content>
        <fo:flow flow-name="xsl-region-body">
            <fo:block>

            </fo:block>
            <fo:block>

            </fo:block>
        </fo:flow>
    </fo:page-sequence>
</fo:root>

Here the code that I've tried:

I made this on layout master-set:

<fo:layout-master-set>
    <fo:simple-page-master
                master-name="pages-normale"
                page-width="297mm"
                page-height="210mm"
                margin-top="0.5cm"
                margin-bottom="0.5cm"
                margin-left="0.5cm"
                margin-right="0.5cm">
        <fo:region-body   margin-top="1cm" margin-bottom="1cm"/>
        <fo:region-before region-name="normal-header" margin-top="1cm" margin-bottom="1cm" extent="7cm"/>
        <fo:region-after  region-name="normal-footer" margin-top="1cm" margin-bottom="1cm" extent="1cm"/>
    </fo:simple-page-master>
    <fo:page-sequence-master master-name="pages">
        <fo:repeatable-page-master-alternatives>
            <fo:conditional-page-master-reference master-reference="pages-last" page-position="last"/>
            <fo:conditional-page-master-reference master-reference="pages-normale" />
        </fo:repeatable-page-master-alternatives>
    </fo:page-sequence-master>
</fo:layout-master-set>

And go this on the following code:

 <fo:page-sequence
        master-reference="pages-normale"

Do this in the page sequence:

<fo:page-sequence force-page-count="no-force"
                    master-reference="pages" initial-page-number="auto"
                    format="1">
    <fo:static-content flow-name="normal-footer">
        <xsl:value-of select="intestazione2_1/cliente3"/>
    </fo:static-content>
</fo:page-sequence>

I've tried to put this page sequence in and out of the <fo:page-sequence master-reference="pages-normale" But the error is the same.

Here the error that FOP gives me:

No simple-page-master matching "pages-last" in page-sequence-master "fo:repeatable-page-master-alternatives". (No context info available)

Here the advice that I followed:

lfurini
  • 3,729
  • 4
  • 30
  • 48
Marco
  • 11
  • 3
  • 1
    In your sample you are using xsl:value-of, are you sure it returns something? Try static text. – Kevin Brown Jun 26 '19 at 16:57
  • 2
    You use `master-reference="pages-last"` in a `fo:conditional-page-master-reference`, but don't you need an `fo:simple-page-master` with a `master-name` of "pages-last"? That seems to be the error FOP is throwing. – Daniel Haley Jun 26 '19 at 17:15

1 Answers1

0

In addition to your <fo:simple-page-master master-name="pages-normale"> you need to define <fo:simple-page-master master-name="pages-last">.

In this master, you need to define a footer with a unique name for the last page <fo:region-after region-name="last-page-footer". Then in your page-sequence, you can add <fo:static-content flow-name="last-page-footer"> and add the information you want to display in that footer.

Hobbes
  • 1,964
  • 3
  • 18
  • 35