1

Topic: xsl:fo The Multipart document in which only one page

Kind time of days.
Faced a problem, there is a document it seems on Russian it  "the summary account the invoice" (the assembly of accounts for example for a time frame on one customer)
In the document practically always some pages. Thus in the first and last page differ Header and Footer.
My problem in that that if in the document only one page Footer the last page it is not fulfilled.
Tried to create two separate fo:repeatable-page-master-alternatives - but I do not know as to make a condition - for handling of one page.
xsl-fo
[spoiler]

<? xml version = "1.0" encoding = "utf-8"?>
<xsl:stylesheet xmlns:xsl = "http://www.w3.org/1999/XSL/Transform" xmlns:fo = "http://www.w3.org/1999/XSL/Format" version = "1.0">
<xsl:template match = "/">
<fo:root xmlns:fo = "http://www.w3.org/1999/XSL/Format" font-family = "Verdana" font-size = "7pt">
<fo:layout-master-set>
<! - Druckbare Fläch-->
<fo:simple-page-master master-name = "firstPage" page-height = "297mm" page-width = "210mm" margin-left = "19.5mm" margin-right = "21.5mm">
<fo:region-body region-name = "xsl-region-body" margin-top = "90mm" margin-bottom = "87mm"/>
<! - Oberer Rand der druckbare fläche-->
<fo:region-before extent = "90mm" region-name = "firstPage"/>
<! - Untere Rand der druckbare fläche-->
<fo:region-after extent = "87mm" region-name = "region-after"/>
</fo:simple-page-master>
<fo:simple-page-master master-name = "allPage" page-height = "297mm" page-width = "210mm" margin-left = "19.5mm" margin-right = "21.5mm">
<fo:region-body region-name = "xsl-region-body" margin-top = "45mm" margin-bottom = "87mm"/>
<! - Oberer Rand der druckbare fläche-->
<fo:region-before extent = "45mm" region-name = "region-befor"/>
<! - Untere Rand der druckbare fläche-->
<fo:region-after extent = "87mm" region-name = "region-after"/>
</fo:simple-page-master>
<fo:simple-page-master master-name = "lastPage" page-height = "297mm" page-width = "210mm" margin-left = "19.5mm" margin-right = "21.5mm">
<fo:region-body region-name = "xsl-region-body" margin-top = "45mm" margin-bottom = "87mm"/>
<! - Oberer Rand der druckbare fläche-->
<fo:region-before extent = "45mm" region-name = "region-befor"/>
<! - Untere Rand der druckbare fläche-->
<fo:region-after extent = "87mm" region-name = "lastPage"/>
</fo:simple-page-master>
<fo:page-sequence-master master-name = "main">
<!- It is not correct. But as on another to make I do not know
<fo:repeatable-page-master-alternatives maximum-repeats = "2">
<fo:conditional-page-master-reference page-position = "rest" master-reference = "allPage"/>
<fo:conditional-page-master-reference page-position = "first" master-reference = "firstPage"/>
<fo:conditional-page-master-reference page-position = "last" master-reference = "lastPage"/>
</fo:repeatable-page-master-alternatives>-->
<fo:repeatable-page-master-alternatives>
<fo:conditional-page-master-reference page-position = "rest" master-reference = "allPage"/>
<fo:conditional-page-master-reference page-position = "first" master-reference = "firstPage"/>
<fo:conditional-page-master-reference page-position = "last" master-reference = "lastPage"/>
</fo:repeatable-page-master-alternatives>
</fo:page-sequence-master>
</fo:layout-master-set>
<! - Seitenveralaufvorlage->
<fo:page-sequence master-reference = "main">
<! - Header mit Logo wenn es sein soll->
<fo:static-content flow-name = "region-befor">
<xsl:call-template name = "anyheader"/>
</fo:static-content>
<fo:static-content flow-name = "firstPage">
<xsl:call-template name = "firstheader"/>
</fo:static-content>
<fo:static-content flow-name = "lastPage">
<xsl:call-template name = "lastfooter"/>
</fo:static-content>
<! - Fusszeilen Alle und die Letzte Seite->
<fo:static-content flow-name = "region-after">
<xsl:call-template name = "anyfooter"/>
</fo:static-content>
<fo:flow flow-name = "xsl-region-body">
<xsl:call-template name = "allbodytext"/>
</fo:flow>
</fo:page-sequence>
</fo:root>
</xsl:template>
<! - Kopf für alle Seiten auser erste Teil->
<xsl:template name = "anyheader">
<xsl:call-template name = "logoblock"/>
<fo:block-container>
<fo:block> anyheader </fo:block>
<fo:block> Kopf für alle Seiten auser erste Teil </fo:block>
</fo:block-container>
</xsl:template>
<! - Adresse Teil->
<xsl:template name = "firstheader">
<xsl:call-template name = "logoblock"/>
<fo:block-container>
<fo:block> firstheader123 </fo:block>
<fo:block> Adresse Teil </fo:block>
</fo:block-container>
</xsl:template>
<! - Logo Block->
<xsl:template name = "logoblock">
<fo:block-container>
<fo:block> logoblock </fo:block>
</fo:block-container>
<fo:block-container>
<fo:block> IMMAGES </fo:block>
</fo:block-container>
</xsl:template>
<! - Body Tabelle->
<xsl:template name = "allbodytext">
<fo:block-container>
<fo:block> allbodytext </fo:block>
<fo:block> Body Tabelle </fo:block>
<fo:table>
<fo:table-column column-width = "500mm"/>
<fo:table-body>
<xsl:for-each select = "/start/numbers">
<fo:table-row>
<fo:table-cell>
<fo:block>
<xsl:value-of select = "number1"/>
<xsl:value-of select = "' - '"/>
<xsl:value-of select = "number2"/>
</fo:block>
</fo:table-cell>
</fo:table-row>
</xsl:for-each>
</fo:table-body>
</fo:table>
</fo:block-container>
</xsl:template>
<xsl:template name = "testPage">
<fo:block-container height = "20mm" border-top-style = "solid" border-bottom-style = "solid">
<fo:block> testPage </fo:block>
</fo:block-container>
<xsl:call-template name = "fusszeile"/>
</xsl:template>
<! - template für Fusszeilen mit dem Text->
<xsl:template name = "anyfooter">
<fo:block-container height = "20mm" border-top-style = "solid" border-bottom-style = "solid">
<fo:block> anyfooter </fo:block>
<fo:block> template für Fusszeilen mit dem Text </fo:block>
</fo:block-container>
<xsl:call-template name = "fusszeile"/>
</xsl:template>
<! - template für lastfooter mit dem Text->
<xsl:template name = "lastfooter">
<fo:block-container height = "20mm" border-top-style = "solid" border-bottom-style = "solid">
<fo:block> lastfooter </fo:block>
<fo:block> ANDERE!!! template für lastfooter mit dem Text </fo:block>
</fo:block-container>
<xsl:call-template name = "fusszeile"/>
</xsl:template>
<xsl:template name = "fusszeile">
<fo:block-container>
<fo:block> fusszeile </fo:block>
<fo:block> NUR DIE fusszeile </fo:block>
</fo:block-container>
</xsl:template>
</xsl:stylesheet>

[/spoiler]
xml
[spoiler]

<? xml version = "1.0" encoding = "UTF-8" standalone = "yes"?>
<start>
<numbers>
<number1> 1 </number1>
<number2> 1000 </number2>
</numbers>
<numbers>
<number1> 2 </number1>
<number2> 1001 </number2>
</numbers>
<numbers>
<number1> 3 </number1>
<number2> 1002 </number2>
</numbers>
<numbers>
<number1> 4 </number1>
<number2> 1003 </number2>
</numbers>
</start>

[/spoiler]