aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas L. Delmelle <adelmelle@apache.org>2008-09-23 18:48:34 +0000
committerAndreas L. Delmelle <adelmelle@apache.org>2008-09-23 18:48:34 +0000
commit1c11a44052e641239a57a28387300ee094b353f8 (patch)
tree966d4f89b9498f82540c91d7a06a5f2353749a22
parent918af3dca86ea73828f985e6a15cf607b8ebcf42 (diff)
downloadxmlgraphics-fop-1c11a44052e641239a57a28387300ee094b353f8.tar.gz
xmlgraphics-fop-1c11a44052e641239a57a28387300ee094b353f8.zip
Bugzilla 40798: A conditional-page-master-reference with page-position="last" is also eligible for an only page (first as well as last)
Additionally: added support for page-position="only" git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@698280 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--src/java/org/apache/fop/fo/pagination/ConditionalPageMasterReference.java66
-rw-r--r--src/java/org/apache/fop/fo/pagination/PageSequence.java59
-rw-r--r--src/java/org/apache/fop/fo/pagination/PageSequenceMaster.java6
-rw-r--r--src/java/org/apache/fop/fo/pagination/RepeatablePageMasterAlternatives.java3
-rw-r--r--src/java/org/apache/fop/fo/pagination/SubSequenceSpecifier.java2
-rw-r--r--src/java/org/apache/fop/layoutmgr/PageProvider.java7
-rw-r--r--src/java/org/apache/fop/render/rtf/RTFHandler.java2
-rw-r--r--status.xml5
-rw-r--r--test/layoutengine/standard-testcases/page-position_last_bug40798.xml118
-rw-r--r--test/layoutengine/standard-testcases/page-position_only.xml115
10 files changed, 289 insertions, 94 deletions
diff --git a/src/java/org/apache/fop/fo/pagination/ConditionalPageMasterReference.java b/src/java/org/apache/fop/fo/pagination/ConditionalPageMasterReference.java
index eaa8c2491..7953731f1 100644
--- a/src/java/org/apache/fop/fo/pagination/ConditionalPageMasterReference.java
+++ b/src/java/org/apache/fop/fo/pagination/ConditionalPageMasterReference.java
@@ -94,61 +94,33 @@ public class ConditionalPageMasterReference extends FObj {
* @param isFirstPage True if page is first page
* @param isLastPage True if page is last page
* @param isBlankPage True if page is blank
- * @param isOnlyPage True if page is the only page
* @return True if the conditions for this reference are met
*/
protected boolean isValid(boolean isOddPage,
boolean isFirstPage,
boolean isLastPage,
- boolean isOnlyPage,
boolean isBlankPage) {
- // page-position
- if (isOnlyPage) {
- if (pagePosition != EN_ONLY) {
- return false;
- }
- } else if (isFirstPage) {
- if (pagePosition == EN_REST) {
- return false;
- } else if (pagePosition == EN_LAST) {
- return false;
- }
- } else if (isLastPage) {
- if (pagePosition == EN_REST) {
- return false;
- } else if (pagePosition == EN_FIRST) {
- return false;
- }
- } else {
- if (pagePosition == EN_FIRST) {
- return false;
- } else if (pagePosition == EN_LAST) {
- return false;
- }
- }
- // odd-or-even
- if (isOddPage) {
- if (oddOrEven == EN_EVEN) {
- return false;
- }
- } else {
- if (oddOrEven == EN_ODD) {
- return false;
- }
- }
+ return (
+ // page-position
+ (pagePosition == EN_ANY
+ || (pagePosition == EN_FIRST && isFirstPage)
+ || (pagePosition == EN_LAST && isLastPage)
+ || (pagePosition == EN_ONLY && (isFirstPage && isLastPage))
+ || (pagePosition == EN_REST && !(isFirstPage || isLastPage))
+ )
+ // odd-or-even
+ && (oddOrEven == EN_ANY
+ || (oddOrEven == EN_ODD && isOddPage)
+ || (oddOrEven == EN_EVEN && !isOddPage)
+ )
+ // blank-or-not-blank
+ && (blankOrNotBlank == EN_ANY
+ || (blankOrNotBlank == EN_BLANK && isBlankPage)
+ || (blankOrNotBlank == EN_NOT_BLANK && !isBlankPage)
+ ));
+
- // blank-or-not-blank
- if (isBlankPage) {
- if (blankOrNotBlank == EN_NOT_BLANK) {
- return false;
- }
- } else {
- if (blankOrNotBlank == EN_BLANK) {
- return false;
- }
- }
- return true;
}
/**
diff --git a/src/java/org/apache/fop/fo/pagination/PageSequence.java b/src/java/org/apache/fop/fo/pagination/PageSequence.java
index bdcb27198..d41ac86ab 100644
--- a/src/java/org/apache/fop/fo/pagination/PageSequence.java
+++ b/src/java/org/apache/fop/fo/pagination/PageSequence.java
@@ -127,19 +127,19 @@ public class PageSequence extends AbstractPageSequence {
protected void validateChildNode(Locator loc, String nsURI, String localName)
throws ValidationException {
if (FO_URI.equals(nsURI)) {
- if (localName.equals("title")) {
+ if ("title".equals(localName)) {
if (titleFO != null) {
tooManyNodesError(loc, "fo:title");
- } else if (flowMap.size() > 0) {
+ } else if (!flowMap.isEmpty()) {
nodesOutOfOrderError(loc, "fo:title", "fo:static-content");
} else if (mainFlow != null) {
nodesOutOfOrderError(loc, "fo:title", "fo:flow");
}
- } else if (localName.equals("static-content")) {
+ } else if ("static-content".equals(localName)) {
if (mainFlow != null) {
nodesOutOfOrderError(loc, "fo:static-content", "fo:flow");
}
- } else if (localName.equals("flow")) {
+ } else if ("flow".equals(localName)) {
if (mainFlow != null) {
tooManyNodesError(loc, "fo:flow");
}
@@ -157,15 +157,20 @@ public class PageSequence extends AbstractPageSequence {
public void addChildNode(FONode child) throws FOPException {
int childId = child.getNameId();
- if (childId == FO_TITLE) {
- this.titleFO = (Title) child;
- } else if (childId == FO_FLOW) {
- this.mainFlow = (Flow) child;
+ switch (childId) {
+ case FO_TITLE:
+ this.titleFO = (Title)child;
+ break;
+ case FO_FLOW:
+ this.mainFlow = (Flow)child;
addFlow(mainFlow);
- } else if (childId == FO_STATIC_CONTENT) {
- addFlow((StaticContent) child);
- String flowName = ((StaticContent) child).getFlowName();
- flowMap.put(flowName, child);
+ break;
+ case FO_STATIC_CONTENT:
+ addFlow((StaticContent)child);
+ flowMap.put(((StaticContent)child).getFlowName(), child);
+ break;
+ default:
+ assert false;
}
}
@@ -245,17 +250,14 @@ public class PageSequence extends AbstractPageSequence {
* page sequence
* @param isLastPage indicator whether this page is the last page of the
* page sequence
- * @param isOnlyPage indicator whether this page is the only page of the
- * page sequence
* @param isBlank indicator whether the page will be blank
* @return the SimplePageMaster to use for this page
* @throws PageProductionException if there's a problem determining the page master
*/
public SimplePageMaster getNextSimplePageMaster(int page,
- boolean isFirstPage,
- boolean isLastPage,
- boolean isOnlyPage,
- boolean isBlank) throws PageProductionException {
+ boolean isFirstPage,
+ boolean isLastPage,
+ boolean isBlank) throws PageProductionException {
if (pageSequenceMaster == null) {
return simplePageMaster;
@@ -266,11 +268,10 @@ public class PageSequence extends AbstractPageSequence {
+ " isOdd=" + isOddPage
+ " isFirst=" + isFirstPage
+ " isLast=" + isLastPage
- + " isOnly=" + isOnlyPage
+ " isBlank=" + isBlank + ")");
}
return pageSequenceMaster.getNextSimplePageMaster(isOddPage,
- isFirstPage, isLastPage, isOnlyPage, isBlank);
+ isFirstPage, isLastPage, isBlank);
}
/**
@@ -278,29 +279,17 @@ public class PageSequence extends AbstractPageSequence {
* @return true if there is a previous item, false if the current one was the first one.
*/
public boolean goToPreviousSimplePageMaster() {
- if (pageSequenceMaster == null) {
- return true;
- } else {
- return pageSequenceMaster.goToPreviousSimplePageMaster();
- }
+ return pageSequenceMaster == null || pageSequenceMaster.goToPreviousSimplePageMaster();
}
/** @return true if the page-sequence has a page-master with page-position="last" */
public boolean hasPagePositionLast() {
- if (pageSequenceMaster == null) {
- return false;
- } else {
- return pageSequenceMaster.hasPagePositionLast();
- }
+ return pageSequenceMaster != null && pageSequenceMaster.hasPagePositionLast();
}
/** @return true if the page-sequence has a page-master with page-position="only" */
public boolean hasPagePositionOnly() {
- if (pageSequenceMaster == null) {
- return false;
- } else {
- return pageSequenceMaster.hasPagePositionOnly();
- }
+ return pageSequenceMaster != null && pageSequenceMaster.hasPagePositionOnly();
}
/**
diff --git a/src/java/org/apache/fop/fo/pagination/PageSequenceMaster.java b/src/java/org/apache/fop/fo/pagination/PageSequenceMaster.java
index b1d8d4055..705b955e9 100644
--- a/src/java/org/apache/fop/fo/pagination/PageSequenceMaster.java
+++ b/src/java/org/apache/fop/fo/pagination/PageSequenceMaster.java
@@ -177,7 +177,6 @@ public class PageSequenceMaster extends FObj {
* @param isOddPage True if the next page number is odd
* @param isFirstPage True if the next page is the first
* @param isLastPage True if the next page is the last
- * @param isOnlyPage True if the next page is the only page
* @param isBlankPage True if the next page is blank
* @return the requested page master
* @throws PageProductionException if there's a problem determining the next page master
@@ -185,7 +184,6 @@ public class PageSequenceMaster extends FObj {
public SimplePageMaster getNextSimplePageMaster(boolean isOddPage,
boolean isFirstPage,
boolean isLastPage,
- boolean isOnlyPage,
boolean isBlankPage)
throws PageProductionException {
if (currentSubSequence == null) {
@@ -198,7 +196,7 @@ public class PageSequenceMaster extends FObj {
}
}
String pageMasterName = currentSubSequence
- .getNextPageMasterName(isOddPage, isFirstPage, isLastPage, isOnlyPage, isBlankPage);
+ .getNextPageMasterName(isOddPage, isFirstPage, isLastPage, isBlankPage);
boolean canRecover = true;
while (pageMasterName == null) {
SubSequenceSpecifier nextSubSequence = getNextSubSequence();
@@ -213,7 +211,7 @@ public class PageSequenceMaster extends FObj {
currentSubSequence = nextSubSequence;
}
pageMasterName = currentSubSequence
- .getNextPageMasterName(isOddPage, isFirstPage, isLastPage, isOnlyPage, isBlankPage);
+ .getNextPageMasterName(isOddPage, isFirstPage, isLastPage, isBlankPage);
}
SimplePageMaster pageMaster = this.layoutMasterSet
.getSimplePageMaster(pageMasterName);
diff --git a/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterAlternatives.java b/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterAlternatives.java
index d1e710c89..9b4c6544f 100644
--- a/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterAlternatives.java
+++ b/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterAlternatives.java
@@ -117,7 +117,6 @@ public class RepeatablePageMasterAlternatives extends FObj
public String getNextPageMasterName(boolean isOddPage,
boolean isFirstPage,
boolean isLastPage,
- boolean isOnlyPage,
boolean isBlankPage) {
if (getMaximumRepeats() != INFINITE) {
if (numberConsumed < getMaximumRepeats()) {
@@ -132,7 +131,7 @@ public class RepeatablePageMasterAlternatives extends FObj
for (int i = 0; i < conditionalPageMasterRefs.size(); i++) {
ConditionalPageMasterReference cpmr
= (ConditionalPageMasterReference)conditionalPageMasterRefs.get(i);
- if (cpmr.isValid(isOddPage, isFirstPage, isLastPage, isOnlyPage, isBlankPage)) {
+ if (cpmr.isValid(isOddPage, isFirstPage, isLastPage, isBlankPage)) {
return cpmr.getMasterReference();
}
}
diff --git a/src/java/org/apache/fop/fo/pagination/SubSequenceSpecifier.java b/src/java/org/apache/fop/fo/pagination/SubSequenceSpecifier.java
index a8eddf5d3..aa2c2bb8b 100644
--- a/src/java/org/apache/fop/fo/pagination/SubSequenceSpecifier.java
+++ b/src/java/org/apache/fop/fo/pagination/SubSequenceSpecifier.java
@@ -31,7 +31,6 @@ public interface SubSequenceSpecifier {
* @param isOddPage True if the next page number is odd
* @param isFirstPage True if the next page is the first
* @param isLastPage True if the next page is the last
- * @param isOnlyPage True if the next page is the only page
* @param isBlankPage True if the next page is blank
* @return the page master name
* @throws PageProductionException if there's a problem determining the next page master
@@ -39,7 +38,6 @@ public interface SubSequenceSpecifier {
String getNextPageMasterName(boolean isOddPage,
boolean isFirstPage,
boolean isLastPage,
- boolean isOnlyPage,
boolean isBlankPage)
throws PageProductionException;
diff --git a/src/java/org/apache/fop/layoutmgr/PageProvider.java b/src/java/org/apache/fop/layoutmgr/PageProvider.java
index 55c78ba52..9073c48bb 100644
--- a/src/java/org/apache/fop/layoutmgr/PageProvider.java
+++ b/src/java/org/apache/fop/layoutmgr/PageProvider.java
@@ -234,13 +234,13 @@ public class PageProvider implements Constants {
indexOfCachedLastPage = (isLastPage ? intIndex : -1);
}
if (replace) {
- disardCacheStartingWith(intIndex);
+ discardCacheStartingWith(intIndex);
page = cacheNextPage(index, isBlank, isLastPage);
}
return page;
}
- private void disardCacheStartingWith(int index) {
+ private void discardCacheStartingWith(int index) {
while (index < cachedPages.size()) {
this.cachedPages.remove(cachedPages.size() - 1);
if (!pageSeq.goToPreviousSimplePageMaster()) {
@@ -251,8 +251,9 @@ public class PageProvider implements Constants {
private Page cacheNextPage(int index, boolean isBlank, boolean isLastPage) {
String pageNumberString = pageSeq.makeFormattedPageNumber(index);
+ boolean isFirstPage = (startPageOfPageSequence == index);
SimplePageMaster spm = pageSeq.getNextSimplePageMaster(
- index, (startPageOfPageSequence == index), isLastPage, false, isBlank);
+ index, isFirstPage, isLastPage, isBlank);
Region body = spm.getRegion(FO_REGION_BODY);
if (!pageSeq.getMainFlow().getFlowName().equals(body.getRegionName())) {
diff --git a/src/java/org/apache/fop/render/rtf/RTFHandler.java b/src/java/org/apache/fop/render/rtf/RTFHandler.java
index 65c7bf681..d3762a436 100644
--- a/src/java/org/apache/fop/render/rtf/RTFHandler.java
+++ b/src/java/org/apache/fop/render/rtf/RTFHandler.java
@@ -222,7 +222,7 @@ public class RTFHandler extends FOEventHandler {
PageSequenceMaster master
= pageSeq.getRoot().getLayoutMasterSet().getPageSequenceMaster(reference);
this.pagemaster = master.getNextSimplePageMaster(
- false, false, false, false, false);
+ false, false, false, false);
}
}
diff --git a/status.xml b/status.xml
index 474267b77..ae924fce2 100644
--- a/status.xml
+++ b/status.xml
@@ -53,6 +53,11 @@
<changes>
<release version="FOP Trunk" date="TBD">
+ <action context="Layout" dev="AD" type="fix" fixes-bug="40798">
+ Bugzilla 40798: A conditional-page-master-reference with page-position="last" qualifies
+ for a first page, if it is also the last. Additionally: also added support for
+ page-position="only".
+ </action>
<action context="Code" dev="AD" type="fix" fixes-bug="45842" due-to="Carsten Siedentop">
Make fop.bat and fop.cmd use the %FOP_OPTS% environment variable.
</action>
diff --git a/test/layoutengine/standard-testcases/page-position_last_bug40798.xml b/test/layoutengine/standard-testcases/page-position_last_bug40798.xml
new file mode 100644
index 000000000..3292b42b1
--- /dev/null
+++ b/test/layoutengine/standard-testcases/page-position_last_bug40798.xml
@@ -0,0 +1,118 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!-- $Id$ -->
+<testcase>
+ <info>
+ <p>
+ This test checks for the use of a 'last' conditional-page-master-reference
+ for a first/only page (see: https://issues.apache.org/bugzilla/show_bug.cgi?id=40798)
+ </p>
+ </info>
+ <fo>
+ <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"
+ font-family="Times" font-size="20pt">
+
+ <fo:layout-master-set>
+ <fo:simple-page-master master-name="only-page-layout"
+ page-height="297mm" page-width="210mm"
+ margin-top="15mm" margin-bottom="15mm"
+ margin-left="15mm" margin-right="15mm">
+ <fo:region-body region-name="frame-body" margin-top="10mm"/>
+ <fo:region-before region-name="only-region" extent="10mm"/>
+ </fo:simple-page-master>
+ <fo:simple-page-master master-name="first-page-layout"
+ page-height="297mm" page-width="210mm"
+ margin-top="15mm" margin-bottom="15mm"
+ margin-left="15mm" margin-right="15mm">
+ <fo:region-body region-name="frame-body" margin-top="10mm"/>
+ <fo:region-before region-name="first-region" extent="10mm"/>
+ </fo:simple-page-master>
+ <fo:simple-page-master master-name="last-page-layout"
+ page-height="297mm" page-width="210mm"
+ margin-top="15mm" margin-bottom="15mm"
+ margin-left="15mm" margin-right="15mm">
+ <fo:region-body region-name="frame-body" margin-top="10mm"/>
+ <fo:region-before region-name="last-region" extent="10mm"/>
+ </fo:simple-page-master>
+ <fo:simple-page-master master-name="rest-page-layout"
+ page-height="297mm" page-width="210mm"
+ margin-top="15mm" margin-bottom="15mm"
+ margin-left="15mm" margin-right="15mm">
+ <fo:region-body region-name="frame-body" margin-top="10mm"/>
+ <fo:region-before region-name="rest-region" extent="10mm"/>
+ </fo:simple-page-master>
+
+ <fo:page-sequence-master master-name="whatever">
+ <fo:repeatable-page-master-alternatives maximum-repeats="1">
+ <fo:conditional-page-master-reference master-reference="only-page-layout"
+ page-position="last"/>
+ <fo:conditional-page-master-reference master-reference="first-page-layout"
+ page-position="first"/>
+ </fo:repeatable-page-master-alternatives>
+ <fo:repeatable-page-master-alternatives maximum-repeats="no-limit">
+ <fo:conditional-page-master-reference master-reference="last-page-layout"
+ page-position="last"/>
+ <fo:conditional-page-master-reference master-reference="rest-page-layout"
+ page-position="rest"/>
+ </fo:repeatable-page-master-alternatives>
+ </fo:page-sequence-master>
+
+ </fo:layout-master-set>
+
+ <fo:page-sequence master-reference="whatever">
+ <fo:static-content flow-name="first-region">
+ <fo:block id="header.first.1" text-align="center">first</fo:block>
+ </fo:static-content>
+ <fo:static-content flow-name="only-region">
+ <fo:block id="header.only.1" text-align="center">only</fo:block>
+ </fo:static-content>
+ <fo:flow flow-name="frame-body">
+ <fo:block>This is the only page</fo:block>
+ </fo:flow>
+ </fo:page-sequence>
+ <fo:page-sequence master-reference="whatever">
+ <fo:static-content flow-name="only-region">
+ <fo:block id="header.only.2" text-align="center">only</fo:block>
+ </fo:static-content>
+ <fo:static-content flow-name="first-region">
+ <fo:block id="header.first.2" text-align="center">first</fo:block>
+ </fo:static-content>
+ <fo:static-content flow-name="last-region">
+ <fo:block id="header.last.2" text-align="center">last</fo:block>
+ </fo:static-content>
+ <fo:static-content flow-name="rest-region">
+ <fo:block id="header.rest.2" text-align="center">rest</fo:block>
+ </fo:static-content>
+ <fo:flow flow-name="frame-body">
+ <fo:block>This is the first page</fo:block>
+ <fo:block break-before="page">This is a middle page</fo:block>
+ <fo:block break-before="page">This is a middle page</fo:block>
+ <fo:block break-before="page">This is the last page</fo:block>
+ </fo:flow>
+ </fo:page-sequence>
+
+ </fo:root>
+ </fo>
+ <checks>
+ <eval expected="header.only.1" xpath="(/areaTree/pageSequence[1]//regionBefore)[1]/block[1]/@prod-id" />
+ <eval expected="header.first.2" xpath="(/areaTree/pageSequence[2]//regionBefore)[1]/block[1]/@prod-id" />
+ <eval expected="header.rest.2" xpath="(/areaTree/pageSequence[2]//regionBefore)[2]/block[1]/@prod-id" />
+ <eval expected="header.rest.2" xpath="(/areaTree/pageSequence[2]//regionBefore)[3]/block[1]/@prod-id" />
+ <eval expected="header.last.2" xpath="(/areaTree/pageSequence[2]//regionBefore)[4]/block[1]/@prod-id" />
+ </checks>
+</testcase>
diff --git a/test/layoutengine/standard-testcases/page-position_only.xml b/test/layoutengine/standard-testcases/page-position_only.xml
new file mode 100644
index 000000000..bcf05db2c
--- /dev/null
+++ b/test/layoutengine/standard-testcases/page-position_only.xml
@@ -0,0 +1,115 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!-- $Id$ -->
+<testcase>
+ <info>
+ <p>
+ This test checks for the use of an 'only' conditional-page-master-reference (XSL 1.1)
+ </p>
+ </info>
+ <fo>
+ <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"
+ font-family="Times" font-size="20pt">
+
+ <fo:layout-master-set>
+ <fo:simple-page-master master-name="only-page-layout"
+ page-height="297mm" page-width="210mm"
+ margin-top="15mm" margin-bottom="15mm"
+ margin-left="15mm" margin-right="15mm">
+ <fo:region-body region-name="frame-body" margin-top="10mm"/>
+ <fo:region-before region-name="only-region" extent="10mm"/>
+ </fo:simple-page-master>
+ <fo:simple-page-master master-name="first-page-layout"
+ page-height="297mm" page-width="210mm"
+ margin-top="15mm" margin-bottom="15mm"
+ margin-left="15mm" margin-right="15mm">
+ <fo:region-body region-name="frame-body" margin-top="10mm"/>
+ <fo:region-before region-name="first-region" extent="10mm"/>
+ </fo:simple-page-master>
+ <fo:simple-page-master master-name="last-page-layout"
+ page-height="297mm" page-width="210mm"
+ margin-top="15mm" margin-bottom="15mm"
+ margin-left="15mm" margin-right="15mm">
+ <fo:region-body region-name="frame-body" margin-top="10mm"/>
+ <fo:region-before region-name="last-region" extent="10mm"/>
+ </fo:simple-page-master>
+ <fo:simple-page-master master-name="rest-page-layout"
+ page-height="297mm" page-width="210mm"
+ margin-top="15mm" margin-bottom="15mm"
+ margin-left="15mm" margin-right="15mm">
+ <fo:region-body region-name="frame-body" margin-top="10mm"/>
+ <fo:region-before region-name="rest-region" extent="10mm"/>
+ </fo:simple-page-master>
+
+ <fo:page-sequence-master master-name="whatever">
+ <fo:repeatable-page-master-alternatives maximum-repeats="no-limit">
+ <fo:conditional-page-master-reference master-reference="only-page-layout"
+ page-position="only"/>
+ <fo:conditional-page-master-reference master-reference="first-page-layout"
+ page-position="first"/>
+ <fo:conditional-page-master-reference master-reference="last-page-layout"
+ page-position="last"/>
+ <fo:conditional-page-master-reference master-reference="rest-page-layout"
+ page-position="rest"/>
+ </fo:repeatable-page-master-alternatives>
+ </fo:page-sequence-master>
+
+ </fo:layout-master-set>
+
+ <fo:page-sequence master-reference="whatever">
+ <fo:static-content flow-name="first-region">
+ <fo:block id="header.first.1" text-align="center">first</fo:block>
+ </fo:static-content>
+ <fo:static-content flow-name="only-region">
+ <fo:block id="header.only.1" text-align="center">only</fo:block>
+ </fo:static-content>
+ <fo:flow flow-name="frame-body">
+ <fo:block>This is the only page</fo:block>
+ </fo:flow>
+ </fo:page-sequence>
+ <fo:page-sequence master-reference="whatever">
+ <fo:static-content flow-name="only-region">
+ <fo:block id="header.only.2" text-align="center">only</fo:block>
+ </fo:static-content>
+ <fo:static-content flow-name="first-region">
+ <fo:block id="header.first.2" text-align="center">first</fo:block>
+ </fo:static-content>
+ <fo:static-content flow-name="last-region">
+ <fo:block id="header.last.2" text-align="center">last</fo:block>
+ </fo:static-content>
+ <fo:static-content flow-name="rest-region">
+ <fo:block id="header.rest.2" text-align="center">rest</fo:block>
+ </fo:static-content>
+ <fo:flow flow-name="frame-body">
+ <fo:block>This is the first page</fo:block>
+ <fo:block break-before="page">This is a middle page</fo:block>
+ <fo:block break-before="page">This is a middle page</fo:block>
+ <fo:block break-before="page">This is the last page</fo:block>
+ </fo:flow>
+ </fo:page-sequence>
+
+ </fo:root>
+ </fo>
+ <checks>
+ <eval expected="header.only.1" xpath="(/areaTree/pageSequence[1]//regionBefore)[1]/block[1]/@prod-id" />
+ <eval expected="header.first.2" xpath="(/areaTree/pageSequence[2]//regionBefore)[1]/block[1]/@prod-id" />
+ <eval expected="header.rest.2" xpath="(/areaTree/pageSequence[2]//regionBefore)[2]/block[1]/@prod-id" />
+ <eval expected="header.rest.2" xpath="(/areaTree/pageSequence[2]//regionBefore)[3]/block[1]/@prod-id" />
+ <eval expected="header.last.2" xpath="(/areaTree/pageSequence[2]//regionBefore)[4]/block[1]/@prod-id" />
+ </checks>
+</testcase>