]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Added support for breaks before and after table cells
authorVincent Hennebert <vhennebert@apache.org>
Wed, 13 Feb 2008 18:11:06 +0000 (18:11 +0000)
committerVincent Hennebert <vhennebert@apache.org>
Wed, 13 Feb 2008 18:11:06 +0000 (18:11 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@627553 13f79535-47bb-0310-9956-ffa450edef68

17 files changed:
src/java/org/apache/fop/fo/flow/table/EffRow.java
src/java/org/apache/fop/fo/flow/table/EmptyGridUnit.java
src/java/org/apache/fop/fo/flow/table/PrimaryGridUnit.java
src/java/org/apache/fop/layoutmgr/table/ActiveCell.java
src/java/org/apache/fop/layoutmgr/table/RowGroupLayoutManager.java
src/java/org/apache/fop/layoutmgr/table/RowPainter.java
src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java
src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java
src/java/org/apache/fop/layoutmgr/table/TableStepper.java
src/java/org/apache/fop/util/BreakUtil.java [new file with mode: 0644]
status.xml
test/layoutengine/standard-testcases/table-cell_break-after.xml [new file with mode: 0644]
test/layoutengine/standard-testcases/table-cell_break-after_last-row.xml [new file with mode: 0644]
test/layoutengine/standard-testcases/table-cell_break-before.xml [new file with mode: 0644]
test/layoutengine/standard-testcases/table-cell_break-before_first-row.xml [new file with mode: 0644]
test/layoutengine/standard-testcases/table-cell_break-before_inside.xml
test/layoutengine/standard-testcases/table-cell_row-span_breaks.xml [new file with mode: 0644]

index fb2162e556826773e94d984b63ebb8ce72e9c7c0..ac99a1d378e2ba7edd00cd6fbe125c4f5aa7dc3e 100644 (file)
@@ -22,8 +22,10 @@ package org.apache.fop.fo.flow.table;
 import java.util.Iterator;
 import java.util.List;
 
+import org.apache.fop.fo.Constants;
 import org.apache.fop.layoutmgr.table.TableRowIterator;
 import org.apache.fop.traits.MinOptMax;
+import org.apache.fop.util.BreakUtil;
 
 /**
  * This class represents an effective row in a table and holds a list of grid units occupying
@@ -159,7 +161,50 @@ public class EffRow {
             throw new IllegalArgumentException("Illegal flag queried: " +  which);
         }
     }
-    
+
+
+    /**
+     * Returns the break class for this row. This is a combination of break-before set on
+     * the first children of any cells starting on this row.
+     * <p><strong>Note:</strong> this works only after getNextKuthElements on the
+     * corresponding TableCellLM have been called!</p>
+     * 
+     * @return one of {@link Constants#EN_AUTO}, {@link Constants#EN_COLUMN}, {@link
+     * Constants#EN_PAGE}, {@link Constants#EN_EVEN_PAGE}, {@link Constants#EN_ODD_PAGE}
+     */
+    public int getBreakBefore() {
+        int breakBefore = Constants.EN_AUTO;
+        for (Iterator iter = gridUnits.iterator(); iter.hasNext();) {
+            GridUnit gu = (GridUnit) iter.next();
+            if (gu.isPrimary()) {
+                breakBefore = BreakUtil.compareBreakClasses(breakBefore,
+                        gu.getPrimary().getBreakBefore());
+            }
+        }
+        return breakBefore;
+    }
+
+    /**
+     * Returns the break class for this row. This is a combination of break-after set on
+     * the last children of any cells ending on this row.
+     * <p><strong>Note:</strong> this works only after getNextKuthElements on the
+     * corresponding TableCellLM have been called!</p>
+     * 
+     * @return one of {@link Constants#EN_AUTO}, {@link Constants#EN_COLUMN}, {@link
+     * Constants#EN_PAGE}, {@link Constants#EN_EVEN_PAGE}, {@link Constants#EN_ODD_PAGE}
+     */
+    public int getBreakAfter() {
+        int breakAfter = Constants.EN_AUTO;
+        for (Iterator iter = gridUnits.iterator(); iter.hasNext();) {
+            GridUnit gu = (GridUnit) iter.next();
+            if (gu.isPrimary()) {
+                breakAfter = BreakUtil.compareBreakClasses(breakAfter,
+                        gu.getPrimary().getBreakAfter());
+            }
+        }
+        return breakAfter;
+    }
+
     /** {@inheritDoc} */
     public String toString() {
         StringBuffer sb = new StringBuffer("EffRow {");
index ac793f889ebdc6e2ef988773b14f24f422ad53b9..583abcaa3a9b17da8f911797e17d726f8a6e041d 100644 (file)
@@ -52,7 +52,7 @@ public class EmptyGridUnit extends GridUnit {
 
     /** {@inheritDoc} */
     public boolean isPrimary() {
-        return true;
+        return false;
     }
 
     /** {@inheritDoc} */
index cff3c2ac14bb4fb730df3c937fa2b9008708ce02..c95f3f8c3982c2d6fdc3ae386c08e7bc5ac2068b 100644 (file)
@@ -22,6 +22,7 @@ package org.apache.fop.fo.flow.table;
 import java.util.LinkedList;
 import java.util.List;
 
+import org.apache.fop.fo.Constants;
 import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
 import org.apache.fop.layoutmgr.ElementListUtils;
 import org.apache.fop.layoutmgr.table.TableCellLayoutManager;
@@ -51,6 +52,9 @@ public class PrimaryGridUnit extends GridUnit {
     private boolean isSeparateBorderModel;
     private int halfBorderSeparationBPD;
 
+    private int breakBefore = Constants.EN_AUTO;
+    private int breakAfter = Constants.EN_AUTO;
+
     /**
      * Creates a new primary grid unit.
      *
@@ -320,4 +324,42 @@ public class PrimaryGridUnit extends GridUnit {
         cellLM = new TableCellLayoutManager(cell, this);
     }
 
+    /**
+     * Returns the class of the before break for the first child element of this cell.
+     * 
+     * @return one of {@link Constants#EN_AUTO}, {@link Constants#EN_COLUMN}, {@link
+     * Constants#EN_PAGE}, {@link Constants#EN_EVEN_PAGE}, {@link Constants#EN_ODD_PAGE}
+     */
+    public int getBreakBefore() {
+        return breakBefore;
+    }
+
+    /**
+     * Don't use, reserved for TableCellLM. TODO
+     * 
+     * @param breakBefore the breakBefore to set
+     */
+    public void setBreakBefore(int breakBefore) {
+        this.breakBefore = breakBefore;
+    }
+
+    /**
+     * Returns the class of the before after for the last child element of this cell.
+     * 
+     * @return one of {@link Constants#EN_AUTO}, {@link Constants#EN_COLUMN}, {@link
+     * Constants#EN_PAGE}, {@link Constants#EN_EVEN_PAGE}, {@link Constants#EN_ODD_PAGE}
+     */
+    public int getBreakAfter() {
+        return breakAfter;
+    }
+
+    /**
+     * Don't use, reserved for TableCellLM. TODO
+     * 
+     * @param breakAfter the breakAfter to set
+     */
+    public void setBreakAfter(int breakAfter) {
+        this.breakAfter = breakAfter;
+    }
+
 }
index 485c63ea2b71c5da00f48e1c8ed1d30d11667a2a..d89f433700159833751420c6f1caa7f723104483 100644 (file)
@@ -335,6 +335,7 @@ class ActiveCell {
             } else {
                 nextStep.set(afterNextStep);
                 nextStep.start = previousStep.end + 1;
+                afterNextStep.start = nextStep.start;
                 if (afterNextStep.end < elementList.size() - 1) {
                     gotoNextLegalBreak();
                 }
@@ -405,17 +406,6 @@ class ActiveCell {
         }
     }
 
-    /**
-     * Returns true if some content of this cell is part of the chosen next step.
-     * 
-     * @return true if this cell's next step is inferior or equal to the next minimal step
-     */
-    boolean contributesContent() {
-        // return includedInLastStep() && the cell hasn't finished yet, otherwise there's
-        // nothing more to contribute
-        return includedInLastStep() && nextStep.end >= nextStep.start;
-    }
-
     /**
      * Returns true if this cell would be finished after the given step. That is, it would
      * be included in the step and the end of its content would be reached.
@@ -469,14 +459,6 @@ class ActiveCell {
         }
     }
 
-    boolean isLastForcedBreak() {
-        return ((KnuthElement)elementList.get(nextStep.end)).isForcedBreak();
-    }
-
-    int getLastBreakClass() {
-        return ((KnuthPenalty)elementList.get(nextStep.end)).getBreakClass();
-    }
-
     boolean keepWithNextSignal() {
         return keepWithNextSignal;
     }
index 6d66da097beb659024c42c3fd51539b2642c4e7c..0127f4d81e54807b171a7db36ff1bbe9ed51fe85 100644 (file)
@@ -40,6 +40,7 @@ import org.apache.fop.layoutmgr.LayoutContext;
 import org.apache.fop.layoutmgr.ListElement;
 import org.apache.fop.layoutmgr.MinOptMaxUtil;
 import org.apache.fop.traits.MinOptMax;
+import org.apache.fop.util.BreakUtil;
 
 class RowGroupLayoutManager {
 
@@ -66,11 +67,13 @@ class RowGroupLayoutManager {
      */
     int getBreakBefore() {
         TableRow rowFO = rowGroup[0].getTableRow();
+        int breakBefore;
         if (rowFO == null) {
-            return Constants.EN_AUTO;
+            breakBefore = Constants.EN_AUTO;
         } else {
-            return rowFO.getBreakBefore(); 
+            breakBefore = rowFO.getBreakBefore(); 
         }
+        return BreakUtil.compareBreakClasses(breakBefore, rowGroup[0].getBreakBefore());
     }
 
     /**
@@ -81,11 +84,14 @@ class RowGroupLayoutManager {
      */
     int getBreakAfter() {
         TableRow rowFO = rowGroup[rowGroup.length - 1].getTableRow();
+        int breakAfter;
         if (rowFO == null) {
-            return Constants.EN_AUTO;
+            breakAfter = Constants.EN_AUTO;
         } else {
-            return rowFO.getBreakAfter(); 
+            breakAfter = rowFO.getBreakAfter(); 
         }
+        return BreakUtil.compareBreakClasses(breakAfter,
+                rowGroup[rowGroup.length - 1].getBreakAfter());
     }
 
     public LinkedList getNextKnuthElements(LayoutContext context, int alignment, int bodyType) {
index 26880faeaaeb6a961d947b651b0fa4686bda1124..022ff0589db887b650b794832b6c7dd6cba3afbc 100644 (file)
@@ -160,7 +160,17 @@ class RowPainter {
         for (int i = 0; i < colCount; i++) {
             GridUnit currentGU = currentRow.getGridUnit(i);            
             if (!currentGU.isEmpty() && currentGU.getColSpanIndex() == 0
-                    && (lastInPart || currentGU.isLastGridUnitRowSpan())) {
+                    && (lastInPart || currentGU.isLastGridUnitRowSpan())
+                    && firstCellParts[i] != null) {
+                // TODO
+                // The last test above is a workaround for the stepping algorithm's
+                // fundamental flaw making it unable to produce the right element list for
+                // multiple breaks inside a same row group.
+                // (see http://wiki.apache.org/xmlgraphics-fop/TableLayout/KnownProblems)
+                // In some extremely rare cases (forced breaks, very small page height), a
+                // TableContentPosition produced during row delaying may end up alone on a
+                // page. It will not contain the CellPart instances for the cells starting
+                // the next row, so firstCellParts[i] will still be null for those ones.
                 int cellHeight = cellHeights[i];
                 cellHeight += lastCellParts[i].getConditionalAfterContentLength();
                 cellHeight += lastCellParts[i].getBorderPaddingAfter(lastInPart);
@@ -177,7 +187,8 @@ class RowPainter {
         for (int i = 0; i < colCount; i++) {
             GridUnit currentGU = currentRow.getGridUnit(i);            
             if (!currentGU.isEmpty() && currentGU.getColSpanIndex() == 0
-                    && (lastInPart || currentGU.isLastGridUnitRowSpan())) {
+                    && (lastInPart || currentGU.isLastGridUnitRowSpan())
+                    && firstCellParts[i] != null) {
                 assert firstCellParts[i].pgu == currentGU.getPrimary();
                 int borderBeforeWhich;
                 if (firstCellParts[i].start == 0) {
index 9469a11212f71c42d0d01098772dbd4720087fc4..fbc1187236db8e4273dbbf2671c2055bebcaa1da 100644 (file)
@@ -210,7 +210,7 @@ public class TableCellLayoutManager extends BlockStackingLayoutManager
                     // with a SpaceResolver.SpaceHandlingBreakPosition element, having no
                     // LM associated to it. Thus it will stop early instead of adding
                     // areas for following Positions. The above test aims at preventing
-                    // such a situation from occuring. add a null penalty to allow a break
+                    // such a situation from occurring. add a null penalty to allow a break
                     // between blocks
                     contentList.add(new BreakElement(
                             new Position(this), 0, context));
@@ -246,6 +246,16 @@ public class TableCellLayoutManager extends BlockStackingLayoutManager
         }
         //Space resolution
         SpaceResolver.resolveElementList(returnList);
+        if (((KnuthElement) returnList.getFirst()).isForcedBreak()) {
+            primaryGridUnit.setBreakBefore(((KnuthPenalty) returnList.getFirst()).getBreakClass());
+            returnList.removeFirst();
+            assert !returnList.isEmpty();
+        }
+        if (((KnuthElement) returnList.getLast()).isForcedBreak()) {
+            KnuthPenalty p = (KnuthPenalty) returnList.getLast();
+            primaryGridUnit.setBreakAfter(p.getBreakClass());
+            p.setP(0);
+        }
 
         getPSLM().notifyEndOfLayout(((TableCell)getFObj()).getId());
 
index baf1bd369e50b956bed1aa3002c86a1a5b012b50..c09b9b07677e252c1a3ab77cc8f4a1cc58371ddd 100644 (file)
@@ -48,6 +48,7 @@ import org.apache.fop.layoutmgr.Position;
 import org.apache.fop.layoutmgr.PositionIterator;
 import org.apache.fop.layoutmgr.TraitSetter;
 import org.apache.fop.layoutmgr.SpaceResolver.SpaceHandlingBreakPosition;
+import org.apache.fop.util.BreakUtil;
 
 /**
  * Layout manager for table contents, particularly managing the creation of combined element lists.
@@ -212,10 +213,14 @@ public class TableContentLayoutManager implements PercentBaseContext {
         while ((rowGroup = iter.getNextRowGroup()) != null) {
             RowGroupLayoutManager rowGroupLM = new RowGroupLayoutManager(getTableLM(), rowGroup,
                     stepper);
-            if (breakBetween == Constants.EN_AUTO) {
-                // TODO improve
-                breakBetween = rowGroupLM.getBreakBefore();
-            }
+             // TODO
+             // The RowGroupLM.getBreakBefore method will work correctly only after
+             // getNextKnuthElements is called. Indeed TableCellLM will set the values for
+             // breaks on PrimaryGridUnit once it has got the Knuth elements of its
+             // children. This can be changed once all the LMs adopt the same scheme of
+             // querying childrens LMs for breaks instead of producing penalty elements
+            List nextRowGroupElems = rowGroupLM.getNextKnuthElements(context, alignment, bodyType);
+            breakBetween = BreakUtil.compareBreakClasses(breakBetween, rowGroupLM.getBreakBefore());
             if (breakBetween != Constants.EN_AUTO) {
                 if (returnList.size() > 0) {
                     BreakElement breakPoss = (BreakElement) returnList.getLast();
@@ -226,7 +231,7 @@ public class TableContentLayoutManager implements PercentBaseContext {
                             0, -KnuthPenalty.INFINITE, breakBetween, context));
                 }
             }
-            returnList.addAll(rowGroupLM.getNextKnuthElements(context, alignment, bodyType));
+            returnList.addAll(nextRowGroupElems);
             breakBetween = rowGroupLM.getBreakAfter();
         }
         // Break after the table's last row
index 4eff1e931eff327a361a67e87e3685145b7cee35..0b494bf2d8a8bfa88722e932ae114f31130d8387 100644 (file)
@@ -37,6 +37,7 @@ import org.apache.fop.layoutmgr.KnuthGlue;
 import org.apache.fop.layoutmgr.KnuthPenalty;
 import org.apache.fop.layoutmgr.LayoutContext;
 import org.apache.fop.layoutmgr.Position;
+import org.apache.fop.util.BreakUtil;
 
 /**
  * This class processes row groups to create combined element lists for tables.
@@ -243,6 +244,12 @@ public class TableStepper {
             if (signalKeepWithNext || getTableLM().mustKeepTogether()) {
                 p = KnuthPenalty.INFINITE;
             }
+            if (rowFinished && activeRowIndex < rowGroup.length - 1) {
+                nextBreakClass = BreakUtil.compareBreakClasses(nextBreakClass,
+                        rowGroup[activeRowIndex].getBreakAfter());
+                nextBreakClass = BreakUtil.compareBreakClasses(nextBreakClass,
+                        rowGroup[activeRowIndex + 1].getBreakBefore());
+            }
             if (nextBreakClass != Constants.EN_AUTO) {
                 log.trace("Forced break encountered");
                 p = -KnuthPenalty.INFINITE; //Overrides any keeps (see 4.8 in XSL 1.0)
@@ -381,33 +388,8 @@ public class TableStepper {
         nextBreakClass = Constants.EN_AUTO;
         for (Iterator iter = activeCells.iterator(); iter.hasNext();) {
             ActiveCell activeCell = (ActiveCell) iter.next();
-            nextBreakClass = compareBreakClasses(nextBreakClass, activeCell.signalNextStep(step));
-        }
-    }
-
-    // TODO replace that with a proper 1.5 enumeration ASAP
-    // TODO this has nothing to do here
-    private static int getBreakClassPriority(int breakClass) {
-        switch (breakClass) {
-        case Constants.EN_AUTO:      return 0;
-        case Constants.EN_COLUMN:    return 1;
-        case Constants.EN_PAGE:      return 2;
-        case Constants.EN_EVEN_PAGE: return 3;
-        case Constants.EN_ODD_PAGE:  return 3;
-        default: throw new IllegalArgumentException();
-        }
-    }
-
-    // TODO even-page and odd-page can't be compared to each other and instead create a
-    // conflict situation. For now the first encountered break will win, but eventually
-    // some warning message should be sent to the user.
-    private static int compareBreakClasses(int b1, int b2) {
-        int p1 = getBreakClassPriority(b1);
-        int p2 = getBreakClassPriority(b2);
-        if (p1 < p2) {
-            return b2;
-        } else {
-            return b1;
+            nextBreakClass = BreakUtil.compareBreakClasses(nextBreakClass,
+                    activeCell.signalNextStep(step));
         }
     }
 
diff --git a/src/java/org/apache/fop/util/BreakUtil.java b/src/java/org/apache/fop/util/BreakUtil.java
new file mode 100644 (file)
index 0000000..c052846
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * 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$ */
+
+package org.apache.fop.util;
+
+import org.apache.fop.fo.Constants;
+
+/**
+ * A utility class for manipulating break classes (the break-before and break-after properties).
+ */
+public final class BreakUtil {
+
+    private BreakUtil() { }
+
+    // TODO replace that with a proper 1.5 enumeration ASAP
+    private static int getBreakClassPriority(int breakClass) {
+        switch (breakClass) {
+        case Constants.EN_AUTO:      return 0;
+        case Constants.EN_COLUMN:    return 1;
+        case Constants.EN_PAGE:      return 2;
+        case Constants.EN_EVEN_PAGE: return 3;
+        case Constants.EN_ODD_PAGE:  return 3;
+        default: throw new IllegalArgumentException();
+        }
+    }
+
+    /**
+     * Compares the given break classes and return the one that wins. even-page and
+     * odd-page win over page, which wins over column, which wins over auto. If even-page
+     * and odd-page are compared to each other, which one will be returned is undefined.
+     * 
+     * @param break1 a break class, one of {@link Constants#EN_AUTO},
+     * {@link Constants#EN_COLUMN}, {@link Constants#EN_PAGE},
+     * {@link Constants#EN_EVEN_PAGE}, {@link Constants#EN_ODD_PAGE}
+     * @param break2 another break class
+     * @return the break class that wins the comparison
+     */
+    public static int compareBreakClasses(int break1, int break2) {
+        // TODO implement some warning mechanism if even-page and odd-page are being compared
+        int p1 = getBreakClassPriority(break1);
+        int p2 = getBreakClassPriority(break2);
+        if (p1 < p2) {
+            return break2;
+        } else {
+            return break1;
+        }
+    }
+
+}
index 2eaf1a553dc1bdb0b5dd7e333fe995282d7b9299..367bdf58d23f242a3a39b69a830a5f868120a444 100644 (file)
 
   <changes>
     <release version="FOP Trunk">
+      <action context="Layout" dev="VH" type="add">
+        Added full support for breaks before and after table cells (that is, break-before/after set
+        on the first/last child of a cell).
+      </action>
       <action context="Layout" dev="VH" type="add">
         Added full support for breaks inside the cells of a table.
       </action>
diff --git a/test/layoutengine/standard-testcases/table-cell_break-after.xml b/test/layoutengine/standard-testcases/table-cell_break-after.xml
new file mode 100644 (file)
index 0000000..35d3f62
--- /dev/null
@@ -0,0 +1,1018 @@
+<?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 that break-after set on blocks in table-cells works correctly in various
+      conditions: when headers/footers shall be repeated at page breaks or not, in the separate or
+      collapsing border model, etc.
+    </p>
+  </info>
+  <fo>
+    <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
+      <fo:layout-master-set>
+        <fo:simple-page-master master-name="page" page-height="10cm" page-width="15cm" margin="1cm">
+          <fo:region-body background-color="#F0F0F0"/>
+        </fo:simple-page-master>
+      </fo:layout-master-set>
+
+      <!-- 1. separate border model, discarded borders, no header/footer -->
+      <fo:page-sequence master-reference="page" font-size="8pt" line-height="10pt">
+        <fo:flow flow-name="xsl-region-body">
+          <fo:block>1. Before the table</fo:block>
+          <fo:table width="100%" table-layout="fixed"
+            border-collapse="separate" border="2pt solid black">
+            <fo:table-column column-width="proportional-column-width(1)" number-columns-repeated="2"/>
+            <fo:table-body>
+              <fo:table-row border="2pt solid green">
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 1.1</fo:block>
+                  <fo:block>Cell 1.1</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 1.2</fo:block>
+                  <fo:block>Cell 1.2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+              <fo:table-row border="2pt solid red">
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 2.1</fo:block>
+                  <fo:block break-after="page">Cell 2.1</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 2.2</fo:block>
+                  <fo:block>Cell 2.2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+              <fo:table-row border="2pt solid orange">
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 3.1</fo:block>
+                  <fo:block>Cell 3.1</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 3.2</fo:block>
+                  <fo:block>Cell 3.2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+            </fo:table-body>
+          </fo:table>
+          <fo:block>After the table</fo:block>
+        </fo:flow>
+      </fo:page-sequence>
+
+      <!-- 2. separate border model, discarded borders, repeated header/footer -->
+      <fo:page-sequence master-reference="page" font-size="8pt" line-height="10pt">
+        <fo:flow flow-name="xsl-region-body">
+          <fo:block>2. Before the table</fo:block>
+          <fo:table width="100%" table-layout="fixed"
+            border-collapse="separate" border="2pt solid black"
+            table-omit-header-at-break="false" table-omit-footer-at-break="false">
+            <fo:table-column column-width="proportional-column-width(1)" number-columns-repeated="2"/>
+            <fo:table-header>
+              <fo:table-row border="2pt solid blue">
+                <fo:table-cell border="inherit"><fo:block>Header 1.1</fo:block></fo:table-cell>
+                <fo:table-cell border="inherit"><fo:block>Header 1.2</fo:block></fo:table-cell>
+              </fo:table-row>
+            </fo:table-header>
+            <fo:table-footer>
+              <fo:table-row border="2pt solid purple">
+                <fo:table-cell border="inherit"><fo:block>Footer 1.1</fo:block></fo:table-cell>
+                <fo:table-cell border="inherit"><fo:block>Footer 1.2</fo:block></fo:table-cell>
+              </fo:table-row>
+            </fo:table-footer>
+            <fo:table-body>
+              <fo:table-row border="2pt solid green">
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 1.1</fo:block>
+                  <fo:block>Cell 1.1</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 1.2</fo:block>
+                  <fo:block>Cell 1.2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+              <fo:table-row border="2pt solid red">
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 2.1</fo:block>
+                  <fo:block>Cell 2.1</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 2.2</fo:block>
+                  <fo:block break-after="page">Cell 2.2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+              <fo:table-row border="2pt solid orange">
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 3.1</fo:block>
+                  <fo:block>Cell 3.1</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 3.2</fo:block>
+                  <fo:block>Cell 3.2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+            </fo:table-body>
+          </fo:table>
+          <fo:block>After the table</fo:block>
+        </fo:flow>
+      </fo:page-sequence>
+
+      <!-- 3. separate border model, retained borders, repeated header/footer -->
+      <fo:page-sequence master-reference="page" font-size="8pt" line-height="10pt">
+        <fo:flow flow-name="xsl-region-body">
+          <fo:block>3. Before the table</fo:block>
+          <fo:table width="100%" table-layout="fixed"
+            border-collapse="separate" border="2pt solid black"
+            border-before-width.length="2pt" border-before-width.conditionality="retain"
+            border-after-width.length="2pt" border-after-width.conditionality="retain"
+            table-omit-header-at-break="false" table-omit-footer-at-break="false">
+            <fo:table-column column-width="proportional-column-width(1)" number-columns-repeated="2"/>
+            <fo:table-header>
+              <fo:table-row border="2pt solid blue">
+                <fo:table-cell border="inherit"><fo:block>Header 1.1</fo:block></fo:table-cell>
+                <fo:table-cell border="inherit"><fo:block>Header 1.2</fo:block></fo:table-cell>
+              </fo:table-row>
+            </fo:table-header>
+            <fo:table-footer>
+              <fo:table-row border="2pt solid purple">
+                <fo:table-cell border="inherit"><fo:block>Footer 1.1</fo:block></fo:table-cell>
+                <fo:table-cell border="inherit"><fo:block>Footer 1.2</fo:block></fo:table-cell>
+              </fo:table-row>
+            </fo:table-footer>
+            <fo:table-body>
+              <fo:table-row border="2pt solid green">
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 1.1</fo:block>
+                  <fo:block>Cell 1.1</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 1.2</fo:block>
+                  <fo:block>Cell 1.2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+              <fo:table-row border="2pt solid red">
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 2.1</fo:block>
+                  <fo:block break-after="page">Cell 2.1</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 2.2</fo:block>
+                  <fo:block>Cell 2.2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+              <fo:table-row border="2pt solid orange">
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 3.1</fo:block>
+                  <fo:block>Cell 3.1</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 3.2</fo:block>
+                  <fo:block>Cell 3.2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+            </fo:table-body>
+          </fo:table>
+          <fo:block>After the table</fo:block>
+        </fo:flow>
+      </fo:page-sequence>
+
+      <!-- 4. separate border model, discarded borders, omitted header/footer -->
+      <fo:page-sequence master-reference="page" font-size="8pt" line-height="10pt">
+        <fo:flow flow-name="xsl-region-body">
+          <fo:block>4. Before the table</fo:block>
+          <fo:table width="100%" table-layout="fixed"
+            border-collapse="separate" border="2pt solid black"
+            table-omit-header-at-break="true" table-omit-footer-at-break="true">
+            <fo:table-column column-width="proportional-column-width(1)" number-columns-repeated="2"/>
+            <fo:table-header>
+              <fo:table-row border="2pt solid blue">
+                <fo:table-cell border="inherit"><fo:block>Header 1.1</fo:block></fo:table-cell>
+                <fo:table-cell border="inherit"><fo:block>Header 1.2</fo:block></fo:table-cell>
+              </fo:table-row>
+            </fo:table-header>
+            <fo:table-footer>
+              <fo:table-row border="2pt solid purple">
+                <fo:table-cell border="inherit"><fo:block>Footer 1.1</fo:block></fo:table-cell>
+                <fo:table-cell border="inherit"><fo:block>Footer 1.2</fo:block></fo:table-cell>
+              </fo:table-row>
+            </fo:table-footer>
+            <fo:table-body>
+              <fo:table-row border="2pt solid green">
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 1.1</fo:block>
+                  <fo:block>Cell 1.1</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 1.2</fo:block>
+                  <fo:block>Cell 1.2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+              <fo:table-row border="2pt solid red">
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 2.1</fo:block>
+                  <fo:block>Cell 2.1</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 2.2</fo:block>
+                  <fo:block break-after="page">Cell 2.2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+              <fo:table-row border="2pt solid orange">
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 3.1</fo:block>
+                  <fo:block>Cell 3.1</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 3.2</fo:block>
+                  <fo:block>Cell 3.2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+            </fo:table-body>
+          </fo:table>
+          <fo:block>After the table</fo:block>
+        </fo:flow>
+      </fo:page-sequence>
+
+      <!-- 5. separate border model, retained borders, omitted header/footer -->
+      <fo:page-sequence master-reference="page" font-size="8pt" line-height="10pt">
+        <fo:flow flow-name="xsl-region-body">
+          <fo:block>5. Before the table</fo:block>
+          <fo:table width="100%" table-layout="fixed"
+            border-collapse="separate" border="2pt solid black"
+            border-before-width.length="2pt" border-before-width.conditionality="retain"
+            border-after-width.length="2pt" border-after-width.conditionality="retain"
+            table-omit-header-at-break="true" table-omit-footer-at-break="true">
+            <fo:table-column column-width="proportional-column-width(1)" number-columns-repeated="2"/>
+            <fo:table-header>
+              <fo:table-row border="2pt solid blue">
+                <fo:table-cell border="inherit"><fo:block>Header 1.1</fo:block></fo:table-cell>
+                <fo:table-cell border="inherit"><fo:block>Header 1.2</fo:block></fo:table-cell>
+              </fo:table-row>
+            </fo:table-header>
+            <fo:table-footer>
+              <fo:table-row border="2pt solid purple">
+                <fo:table-cell border="inherit"><fo:block>Footer 1.1</fo:block></fo:table-cell>
+                <fo:table-cell border="inherit"><fo:block>Footer 1.2</fo:block></fo:table-cell>
+              </fo:table-row>
+            </fo:table-footer>
+            <fo:table-body>
+              <fo:table-row border="2pt solid green">
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 1.1</fo:block>
+                  <fo:block>Cell 1.1</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 1.2</fo:block>
+                  <fo:block>Cell 1.2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+              <fo:table-row border="2pt solid red">
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 2.1</fo:block>
+                  <fo:block break-after="page">Cell 2.1</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 2.2</fo:block>
+                  <fo:block>Cell 2.2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+              <fo:table-row border="2pt solid orange">
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 3.1</fo:block>
+                  <fo:block>Cell 3.1</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 3.2</fo:block>
+                  <fo:block>Cell 3.2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+            </fo:table-body>
+          </fo:table>
+          <fo:block>After the table</fo:block>
+        </fo:flow>
+      </fo:page-sequence>
+
+      <!-- 6. collapsing border model, discarded borders, no header/footer -->
+      <fo:page-sequence master-reference="page" font-size="8pt" line-height="10pt">
+        <fo:flow flow-name="xsl-region-body">
+          <fo:block>6. Before the table</fo:block>
+          <fo:table width="100%" table-layout="fixed"
+            border-collapse="collapse" border="2pt solid black">
+            <fo:table-column column-width="proportional-column-width(1)" number-columns-repeated="2"/>
+            <fo:table-body>
+              <fo:table-row border="2pt solid green">
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 1.1</fo:block>
+                  <fo:block>Cell 1.1</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 1.2</fo:block>
+                  <fo:block>Cell 1.2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+              <fo:table-row border="2pt solid red">
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 2.1</fo:block>
+                  <fo:block>Cell 2.1</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 2.2</fo:block>
+                  <fo:block break-after="page">Cell 2.2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+              <fo:table-row border="2pt solid orange">
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 3.1</fo:block>
+                  <fo:block>Cell 3.1</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 3.2</fo:block>
+                  <fo:block>Cell 3.2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+            </fo:table-body>
+          </fo:table>
+          <fo:block>After the table</fo:block>
+        </fo:flow>
+      </fo:page-sequence>
+
+      <!-- 7. collapsing border model, discarded borders, repeated header/footer -->
+      <fo:page-sequence master-reference="page" font-size="8pt" line-height="10pt">
+        <fo:flow flow-name="xsl-region-body">
+          <fo:block>7. Before the table</fo:block>
+          <fo:table width="100%" table-layout="fixed"
+            border-collapse="collapse" border="2pt solid black"
+            table-omit-header-at-break="false" table-omit-footer-at-break="false">
+            <fo:table-column column-width="proportional-column-width(1)" number-columns-repeated="2"/>
+            <fo:table-header>
+              <fo:table-row border="2pt solid blue">
+                <fo:table-cell border="inherit"><fo:block>Header 1.1</fo:block></fo:table-cell>
+                <fo:table-cell border="inherit"><fo:block>Header 1.2</fo:block></fo:table-cell>
+              </fo:table-row>
+            </fo:table-header>
+            <fo:table-footer>
+              <fo:table-row border="2pt solid purple">
+                <fo:table-cell border="inherit"><fo:block>Footer 1.1</fo:block></fo:table-cell>
+                <fo:table-cell border="inherit"><fo:block>Footer 1.2</fo:block></fo:table-cell>
+              </fo:table-row>
+            </fo:table-footer>
+            <fo:table-body>
+              <fo:table-row border="2pt solid green">
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 1.1</fo:block>
+                  <fo:block>Cell 1.1</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 1.2</fo:block>
+                  <fo:block>Cell 1.2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+              <fo:table-row border="2pt solid red">
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 2.1</fo:block>
+                  <fo:block break-after="page">Cell 2.1</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 2.2</fo:block>
+                  <fo:block>Cell 2.2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+              <fo:table-row border="2pt solid orange">
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 3.1</fo:block>
+                  <fo:block>Cell 3.1</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 3.2</fo:block>
+                  <fo:block>Cell 3.2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+            </fo:table-body>
+          </fo:table>
+          <fo:block>After the table</fo:block>
+        </fo:flow>
+      </fo:page-sequence>
+
+      <!-- 8. collapsing border model, discarded borders, omitted header/footer -->
+      <fo:page-sequence master-reference="page" font-size="8pt" line-height="10pt">
+        <fo:flow flow-name="xsl-region-body">
+          <fo:block>8. Before the table</fo:block>
+          <fo:table width="100%" table-layout="fixed"
+            border-collapse="collapse" border="2pt solid black"
+            table-omit-header-at-break="true" table-omit-footer-at-break="true">
+            <fo:table-column column-width="proportional-column-width(1)" number-columns-repeated="2"/>
+            <fo:table-header>
+              <fo:table-row border="2pt solid blue">
+                <fo:table-cell border="inherit"><fo:block>Header 1.1</fo:block></fo:table-cell>
+                <fo:table-cell border="inherit"><fo:block>Header 1.2</fo:block></fo:table-cell>
+              </fo:table-row>
+            </fo:table-header>
+            <fo:table-footer>
+              <fo:table-row border="2pt solid purple">
+                <fo:table-cell border="inherit"><fo:block>Footer 1.1</fo:block></fo:table-cell>
+                <fo:table-cell border="inherit"><fo:block>Footer 1.2</fo:block></fo:table-cell>
+              </fo:table-row>
+            </fo:table-footer>
+            <fo:table-body>
+              <fo:table-row border="2pt solid green">
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 1.1</fo:block>
+                  <fo:block>Cell 1.1</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 1.2</fo:block>
+                  <fo:block>Cell 1.2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+              <fo:table-row border="2pt solid red">
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 2.1</fo:block>
+                  <fo:block>Cell 2.1</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 2.2</fo:block>
+                  <fo:block break-after="page">Cell 2.2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+              <fo:table-row border="2pt solid orange">
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 3.1</fo:block>
+                  <fo:block>Cell 3.1</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 3.2</fo:block>
+                  <fo:block>Cell 3.2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+            </fo:table-body>
+          </fo:table>
+          <fo:block>After the table</fo:block>
+        </fo:flow>
+      </fo:page-sequence>
+
+    </fo:root>
+  </fo>
+  <checks>
+
+    <!-- 1. separate border model, discarded borders, no header/footer -->
+    <!-- page 1 -->
+    <eval expected="2"                    xpath="count(//pageSequence[1]/pageViewport)"/>
+    <eval expected="2"                    xpath="count(//pageViewport[@nr='1']//flow/block)"/>
+    <eval expected="1. Before the table"  xpath="//pageViewport[@nr='1']//flow/block[1]//text"/>
+    <eval expected="48000"                xpath="//pageViewport[@nr='1']//flow/block[2]/@bpd"/>
+    <eval expected="50000"                xpath="//pageViewport[@nr='1']//flow/block[2]/@bpda"/>
+    <eval expected="(solid,#000000,2000)" xpath="//pageViewport[@nr='1']//flow/block[2]/@border-before"/>
+    <eval expected=""                     xpath="//pageViewport[@nr='1']//flow/block[2]/@border-after"/>
+    <!-- cell 1.1 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='1']//flow/block[2]/block[1]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='1']//flow/block[2]/block[1]/@bpda"/>
+    <eval expected="(solid,#008000,2000)" xpath="//pageViewport[@nr='1']//flow/block[2]/block[1]/@border-before"/>
+    <eval expected="(solid,#008000,2000)" xpath="//pageViewport[@nr='1']//flow/block[2]/block[1]/@border-after"/>
+    <!-- cell 1.2 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='1']//flow/block[2]/block[2]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='1']//flow/block[2]/block[2]/@bpda"/>
+    <eval expected="(solid,#008000,2000)" xpath="//pageViewport[@nr='1']//flow/block[2]/block[2]/@border-before"/>
+    <eval expected="(solid,#008000,2000)" xpath="//pageViewport[@nr='1']//flow/block[2]/block[2]/@border-after"/>
+    <!-- cell 2.1 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='1']//flow/block[2]/block[3]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='1']//flow/block[2]/block[3]/@bpda"/>
+    <eval expected="(solid,#ff0000,2000)" xpath="//pageViewport[@nr='1']//flow/block[2]/block[3]/@border-before"/>
+    <eval expected="(solid,#ff0000,2000)" xpath="//pageViewport[@nr='1']//flow/block[2]/block[3]/@border-after"/>
+    <!-- cell 2.2 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='1']//flow/block[2]/block[4]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='1']//flow/block[2]/block[4]/@bpda"/>
+    <eval expected="(solid,#ff0000,2000)" xpath="//pageViewport[@nr='1']//flow/block[2]/block[4]/@border-before"/>
+    <eval expected="(solid,#ff0000,2000)" xpath="//pageViewport[@nr='1']//flow/block[2]/block[4]/@border-after"/>
+    <!-- page 2 -->
+    <eval expected="2"                    xpath="count(//pageViewport[@nr='2']//flow/block)"/>
+    <eval expected="After the table"      xpath="//pageViewport[@nr='2']//flow/block[2]//text"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='2']//flow/block[1]/@bpd"/>
+    <eval expected="26000"                xpath="//pageViewport[@nr='2']//flow/block[1]/@bpda"/>
+    <eval expected=""                     xpath="//pageViewport[@nr='2']//flow/block[1]/@border-before"/>
+    <eval expected="(solid,#000000,2000)" xpath="//pageViewport[@nr='2']//flow/block[1]/@border-after"/>
+    <!-- cell 3.1 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='2']//flow/block[1]/block[1]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='2']//flow/block[1]/block[1]/@bpda"/>
+    <eval expected="(solid,#ffa500,2000)" xpath="//pageViewport[@nr='2']//flow/block[1]/block[1]/@border-before"/>
+    <eval expected="(solid,#ffa500,2000)" xpath="//pageViewport[@nr='2']//flow/block[1]/block[1]/@border-after"/>
+    <!-- cell 3.2 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='2']//flow/block[1]/block[2]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='2']//flow/block[1]/block[2]/@bpda"/>
+    <eval expected="(solid,#ffa500,2000)" xpath="//pageViewport[@nr='2']//flow/block[1]/block[2]/@border-before"/>
+    <eval expected="(solid,#ffa500,2000)" xpath="//pageViewport[@nr='2']//flow/block[1]/block[2]/@border-after"/>
+
+    <!-- 2. separate border model, discarded borders, repeated header/footer -->
+    <!-- page 1 -->
+    <eval expected="2"                    xpath="count(//pageSequence[2]/pageViewport)"/>
+    <eval expected="2"                    xpath="count(//pageViewport[@nr='3']//flow/block)"/>
+    <eval expected="2. Before the table"  xpath="//pageViewport[@nr='3']//flow/block[1]//text"/>
+    <eval expected="76000"                xpath="//pageViewport[@nr='3']//flow/block[2]/@bpd"/>
+    <eval expected="78000"                xpath="//pageViewport[@nr='3']//flow/block[2]/@bpda"/>
+    <eval expected="(solid,#000000,2000)" xpath="//pageViewport[@nr='3']//flow/block[2]/@border-before"/>
+    <eval expected=""                     xpath="//pageViewport[@nr='3']//flow/block[2]/@border-after"/>
+    <!-- header 1.1 -->
+    <eval expected="10000"                xpath="//pageViewport[@nr='3']//flow/block[2]/block[1]/@bpd"/>
+    <eval expected="14000"                xpath="//pageViewport[@nr='3']//flow/block[2]/block[1]/@bpda"/>
+    <eval expected="(solid,#0000ff,2000)" xpath="//pageViewport[@nr='3']//flow/block[2]/block[1]/@border-before"/>
+    <eval expected="(solid,#0000ff,2000)" xpath="//pageViewport[@nr='3']//flow/block[2]/block[1]/@border-after"/>
+    <!-- header 1.2 -->
+    <eval expected="10000"                xpath="//pageViewport[@nr='3']//flow/block[2]/block[2]/@bpd"/>
+    <eval expected="14000"                xpath="//pageViewport[@nr='3']//flow/block[2]/block[2]/@bpda"/>
+    <eval expected="(solid,#0000ff,2000)" xpath="//pageViewport[@nr='3']//flow/block[2]/block[2]/@border-before"/>
+    <eval expected="(solid,#0000ff,2000)" xpath="//pageViewport[@nr='3']//flow/block[2]/block[2]/@border-after"/>
+    <!-- cell 1.1 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='3']//flow/block[2]/block[3]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='3']//flow/block[2]/block[3]/@bpda"/>
+    <eval expected="(solid,#008000,2000)" xpath="//pageViewport[@nr='3']//flow/block[2]/block[3]/@border-before"/>
+    <eval expected="(solid,#008000,2000)" xpath="//pageViewport[@nr='3']//flow/block[2]/block[3]/@border-after"/>
+    <!-- cell 1.2 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='3']//flow/block[2]/block[4]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='3']//flow/block[2]/block[4]/@bpda"/>
+    <eval expected="(solid,#008000,2000)" xpath="//pageViewport[@nr='3']//flow/block[2]/block[4]/@border-before"/>
+    <eval expected="(solid,#008000,2000)" xpath="//pageViewport[@nr='3']//flow/block[2]/block[4]/@border-after"/>
+    <!-- cell 2.1 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='3']//flow/block[2]/block[5]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='3']//flow/block[2]/block[5]/@bpda"/>
+    <eval expected="(solid,#ff0000,2000)" xpath="//pageViewport[@nr='3']//flow/block[2]/block[5]/@border-before"/>
+    <eval expected="(solid,#ff0000,2000)" xpath="//pageViewport[@nr='3']//flow/block[2]/block[5]/@border-after"/>
+    <!-- cell 2.2 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='3']//flow/block[2]/block[6]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='3']//flow/block[2]/block[6]/@bpda"/>
+    <eval expected="(solid,#ff0000,2000)" xpath="//pageViewport[@nr='3']//flow/block[2]/block[6]/@border-before"/>
+    <eval expected="(solid,#ff0000,2000)" xpath="//pageViewport[@nr='3']//flow/block[2]/block[6]/@border-after"/>
+    <!-- footer 1.1 -->
+    <eval expected="10000"                xpath="//pageViewport[@nr='3']//flow/block[2]/block[7]/@bpd"/>
+    <eval expected="14000"                xpath="//pageViewport[@nr='3']//flow/block[2]/block[7]/@bpda"/>
+    <eval expected="(solid,#800080,2000)" xpath="//pageViewport[@nr='3']//flow/block[2]/block[7]/@border-before"/>
+    <eval expected="(solid,#800080,2000)" xpath="//pageViewport[@nr='3']//flow/block[2]/block[7]/@border-after"/>
+    <!-- footer 1.2 -->
+    <eval expected="10000"                xpath="//pageViewport[@nr='3']//flow/block[2]/block[8]/@bpd"/>
+    <eval expected="14000"                xpath="//pageViewport[@nr='3']//flow/block[2]/block[8]/@bpda"/>
+    <eval expected="(solid,#800080,2000)" xpath="//pageViewport[@nr='3']//flow/block[2]/block[8]/@border-before"/>
+    <eval expected="(solid,#800080,2000)" xpath="//pageViewport[@nr='3']//flow/block[2]/block[8]/@border-after"/>
+    <!-- page 2 -->
+    <eval expected="2"                    xpath="count(//pageViewport[@nr='4']//flow/block)"/>
+    <eval expected="After the table"      xpath="//pageViewport[@nr='4']//flow/block[2]//text"/>
+    <eval expected="52000"                xpath="//pageViewport[@nr='4']//flow/block[1]/@bpd"/>
+    <eval expected="54000"                xpath="//pageViewport[@nr='4']//flow/block[1]/@bpda"/>
+    <eval expected=""                     xpath="//pageViewport[@nr='4']//flow/block[1]/@border-before"/>
+    <eval expected="(solid,#000000,2000)" xpath="//pageViewport[@nr='4']//flow/block[1]/@border-after"/>
+    <!-- header 1.1 -->
+    <eval expected="10000"                xpath="//pageViewport[@nr='4']//flow/block[1]/block[1]/@bpd"/>
+    <eval expected="14000"                xpath="//pageViewport[@nr='4']//flow/block[1]/block[1]/@bpda"/>
+    <eval expected="(solid,#0000ff,2000)" xpath="//pageViewport[@nr='4']//flow/block[1]/block[1]/@border-before"/>
+    <eval expected="(solid,#0000ff,2000)" xpath="//pageViewport[@nr='4']//flow/block[1]/block[1]/@border-after"/>
+    <!-- header 1.2 -->
+    <eval expected="10000"                xpath="//pageViewport[@nr='4']//flow/block[1]/block[2]/@bpd"/>
+    <eval expected="14000"                xpath="//pageViewport[@nr='4']//flow/block[1]/block[2]/@bpda"/>
+    <eval expected="(solid,#0000ff,2000)" xpath="//pageViewport[@nr='4']//flow/block[1]/block[2]/@border-before"/>
+    <eval expected="(solid,#0000ff,2000)" xpath="//pageViewport[@nr='4']//flow/block[1]/block[2]/@border-after"/>
+    <!-- cell 3.1 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='4']//flow/block[1]/block[3]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='4']//flow/block[1]/block[3]/@bpda"/>
+    <eval expected="(solid,#ffa500,2000)" xpath="//pageViewport[@nr='4']//flow/block[1]/block[3]/@border-before"/>
+    <eval expected="(solid,#ffa500,2000)" xpath="//pageViewport[@nr='4']//flow/block[1]/block[3]/@border-after"/>
+    <!-- cell 3.2 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='4']//flow/block[1]/block[4]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='4']//flow/block[1]/block[4]/@bpda"/>
+    <eval expected="(solid,#ffa500,2000)" xpath="//pageViewport[@nr='4']//flow/block[1]/block[4]/@border-before"/>
+    <eval expected="(solid,#ffa500,2000)" xpath="//pageViewport[@nr='4']//flow/block[1]/block[4]/@border-after"/>
+    <!-- footer 1.1 -->
+    <eval expected="10000"                xpath="//pageViewport[@nr='4']//flow/block[1]/block[5]/@bpd"/>
+    <eval expected="14000"                xpath="//pageViewport[@nr='4']//flow/block[1]/block[5]/@bpda"/>
+    <eval expected="(solid,#800080,2000)" xpath="//pageViewport[@nr='4']//flow/block[1]/block[5]/@border-before"/>
+    <eval expected="(solid,#800080,2000)" xpath="//pageViewport[@nr='4']//flow/block[1]/block[5]/@border-after"/>
+    <!-- footer 1.2 -->
+    <eval expected="10000"                xpath="//pageViewport[@nr='4']//flow/block[1]/block[6]/@bpd"/>
+    <eval expected="14000"                xpath="//pageViewport[@nr='4']//flow/block[1]/block[6]/@bpda"/>
+    <eval expected="(solid,#800080,2000)" xpath="//pageViewport[@nr='4']//flow/block[1]/block[6]/@border-before"/>
+    <eval expected="(solid,#800080,2000)" xpath="//pageViewport[@nr='4']//flow/block[1]/block[6]/@border-after"/>
+
+    <!-- 3. separate border model, retained borders, repeated header/footer -->
+    <!-- page 1 -->
+    <eval expected="2"                    xpath="count(//pageSequence[3]/pageViewport)"/>
+    <eval expected="2"                    xpath="count(//pageViewport[@nr='5']//flow/block)"/>
+    <eval expected="3. Before the table"  xpath="//pageViewport[@nr='5']//flow/block[1]//text"/>
+    <eval expected="76000"                xpath="//pageViewport[@nr='5']//flow/block[2]/@bpd"/>
+    <eval expected="80000"                xpath="//pageViewport[@nr='5']//flow/block[2]/@bpda"/>
+    <eval expected="(solid,#000000,2000)" xpath="//pageViewport[@nr='5']//flow/block[2]/@border-before"/>
+    <eval expected="(solid,#000000,2000)" xpath="//pageViewport[@nr='5']//flow/block[2]/@border-after"/>
+    <!-- header 1.1 -->
+    <eval expected="10000"                xpath="//pageViewport[@nr='5']//flow/block[2]/block[1]/@bpd"/>
+    <eval expected="14000"                xpath="//pageViewport[@nr='5']//flow/block[2]/block[1]/@bpda"/>
+    <eval expected="(solid,#0000ff,2000)" xpath="//pageViewport[@nr='5']//flow/block[2]/block[1]/@border-before"/>
+    <eval expected="(solid,#0000ff,2000)" xpath="//pageViewport[@nr='5']//flow/block[2]/block[1]/@border-after"/>
+    <!-- header 1.2 -->
+    <eval expected="10000"                xpath="//pageViewport[@nr='5']//flow/block[2]/block[2]/@bpd"/>
+    <eval expected="14000"                xpath="//pageViewport[@nr='5']//flow/block[2]/block[2]/@bpda"/>
+    <eval expected="(solid,#0000ff,2000)" xpath="//pageViewport[@nr='5']//flow/block[2]/block[2]/@border-before"/>
+    <eval expected="(solid,#0000ff,2000)" xpath="//pageViewport[@nr='5']//flow/block[2]/block[2]/@border-after"/>
+    <!-- cell 1.1 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='5']//flow/block[2]/block[3]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='5']//flow/block[2]/block[3]/@bpda"/>
+    <eval expected="(solid,#008000,2000)" xpath="//pageViewport[@nr='5']//flow/block[2]/block[3]/@border-before"/>
+    <eval expected="(solid,#008000,2000)" xpath="//pageViewport[@nr='5']//flow/block[2]/block[3]/@border-after"/>
+    <!-- cell 1.2 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='5']//flow/block[2]/block[4]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='5']//flow/block[2]/block[4]/@bpda"/>
+    <eval expected="(solid,#008000,2000)" xpath="//pageViewport[@nr='5']//flow/block[2]/block[4]/@border-before"/>
+    <eval expected="(solid,#008000,2000)" xpath="//pageViewport[@nr='5']//flow/block[2]/block[4]/@border-after"/>
+    <!-- cell 2.1 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='5']//flow/block[2]/block[5]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='5']//flow/block[2]/block[5]/@bpda"/>
+    <eval expected="(solid,#ff0000,2000)" xpath="//pageViewport[@nr='5']//flow/block[2]/block[5]/@border-before"/>
+    <eval expected="(solid,#ff0000,2000)" xpath="//pageViewport[@nr='5']//flow/block[2]/block[5]/@border-after"/>
+    <!-- cell 2.2 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='5']//flow/block[2]/block[6]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='5']//flow/block[2]/block[6]/@bpda"/>
+    <eval expected="(solid,#ff0000,2000)" xpath="//pageViewport[@nr='5']//flow/block[2]/block[6]/@border-before"/>
+    <eval expected="(solid,#ff0000,2000)" xpath="//pageViewport[@nr='5']//flow/block[2]/block[6]/@border-after"/>
+    <!-- footer 1.1 -->
+    <eval expected="10000"                xpath="//pageViewport[@nr='5']//flow/block[2]/block[7]/@bpd"/>
+    <eval expected="14000"                xpath="//pageViewport[@nr='5']//flow/block[2]/block[7]/@bpda"/>
+    <eval expected="(solid,#800080,2000)" xpath="//pageViewport[@nr='5']//flow/block[2]/block[7]/@border-before"/>
+    <eval expected="(solid,#800080,2000)" xpath="//pageViewport[@nr='5']//flow/block[2]/block[7]/@border-after"/>
+    <!-- footer 1.2 -->
+    <eval expected="10000"                xpath="//pageViewport[@nr='5']//flow/block[2]/block[8]/@bpd"/>
+    <eval expected="14000"                xpath="//pageViewport[@nr='5']//flow/block[2]/block[8]/@bpda"/>
+    <eval expected="(solid,#800080,2000)" xpath="//pageViewport[@nr='5']//flow/block[2]/block[8]/@border-before"/>
+    <eval expected="(solid,#800080,2000)" xpath="//pageViewport[@nr='5']//flow/block[2]/block[8]/@border-after"/>
+    <!-- page 2 -->
+    <eval expected="2"                    xpath="count(//pageViewport[@nr='6']//flow/block)"/>
+    <eval expected="After the table"      xpath="//pageViewport[@nr='6']//flow/block[2]//text"/>
+    <eval expected="52000"                xpath="//pageViewport[@nr='6']//flow/block[1]/@bpd"/>
+    <eval expected="56000"                xpath="//pageViewport[@nr='6']//flow/block[1]/@bpda"/>
+    <eval expected="(solid,#000000,2000)" xpath="//pageViewport[@nr='6']//flow/block[1]/@border-before"/>
+    <eval expected="(solid,#000000,2000)" xpath="//pageViewport[@nr='6']//flow/block[1]/@border-after"/>
+    <!-- header 1.1 -->
+    <eval expected="10000"                xpath="//pageViewport[@nr='6']//flow/block[1]/block[1]/@bpd"/>
+    <eval expected="14000"                xpath="//pageViewport[@nr='6']//flow/block[1]/block[1]/@bpda"/>
+    <eval expected="(solid,#0000ff,2000)" xpath="//pageViewport[@nr='6']//flow/block[1]/block[1]/@border-before"/>
+    <eval expected="(solid,#0000ff,2000)" xpath="//pageViewport[@nr='6']//flow/block[1]/block[1]/@border-after"/>
+    <!-- header 1.2 -->
+    <eval expected="10000"                xpath="//pageViewport[@nr='6']//flow/block[1]/block[2]/@bpd"/>
+    <eval expected="14000"                xpath="//pageViewport[@nr='6']//flow/block[1]/block[2]/@bpda"/>
+    <eval expected="(solid,#0000ff,2000)" xpath="//pageViewport[@nr='6']//flow/block[1]/block[2]/@border-before"/>
+    <eval expected="(solid,#0000ff,2000)" xpath="//pageViewport[@nr='6']//flow/block[1]/block[2]/@border-after"/>
+    <!-- cell 3.1 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='6']//flow/block[1]/block[3]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='6']//flow/block[1]/block[3]/@bpda"/>
+    <eval expected="(solid,#ffa500,2000)" xpath="//pageViewport[@nr='6']//flow/block[1]/block[3]/@border-before"/>
+    <eval expected="(solid,#ffa500,2000)" xpath="//pageViewport[@nr='6']//flow/block[1]/block[3]/@border-after"/>
+    <!-- cell 3.2 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='6']//flow/block[1]/block[4]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='6']//flow/block[1]/block[4]/@bpda"/>
+    <eval expected="(solid,#ffa500,2000)" xpath="//pageViewport[@nr='6']//flow/block[1]/block[4]/@border-before"/>
+    <eval expected="(solid,#ffa500,2000)" xpath="//pageViewport[@nr='6']//flow/block[1]/block[4]/@border-after"/>
+    <!-- footer 1.1 -->
+    <eval expected="10000"                xpath="//pageViewport[@nr='6']//flow/block[1]/block[5]/@bpd"/>
+    <eval expected="14000"                xpath="//pageViewport[@nr='6']//flow/block[1]/block[5]/@bpda"/>
+    <eval expected="(solid,#800080,2000)" xpath="//pageViewport[@nr='6']//flow/block[1]/block[5]/@border-before"/>
+    <eval expected="(solid,#800080,2000)" xpath="//pageViewport[@nr='6']//flow/block[1]/block[5]/@border-after"/>
+    <!-- footer 1.2 -->
+    <eval expected="10000"                xpath="//pageViewport[@nr='6']//flow/block[1]/block[6]/@bpd"/>
+    <eval expected="14000"                xpath="//pageViewport[@nr='6']//flow/block[1]/block[6]/@bpda"/>
+    <eval expected="(solid,#800080,2000)" xpath="//pageViewport[@nr='6']//flow/block[1]/block[6]/@border-before"/>
+    <eval expected="(solid,#800080,2000)" xpath="//pageViewport[@nr='6']//flow/block[1]/block[6]/@border-after"/>
+
+    <!-- 4. separate border model, discarded borders, omitted header/footer -->
+    <!-- page 1 -->
+    <eval expected="2"                    xpath="count(//pageSequence[4]/pageViewport)"/>
+    <eval expected="2"                    xpath="count(//pageViewport[@nr='7']//flow/block)"/>
+    <eval expected="4. Before the table"  xpath="//pageViewport[@nr='7']//flow/block[1]//text"/>
+    <eval expected="62000"                xpath="//pageViewport[@nr='7']//flow/block[2]/@bpd"/>
+    <eval expected="64000"                xpath="//pageViewport[@nr='7']//flow/block[2]/@bpda"/>
+    <eval expected="(solid,#000000,2000)" xpath="//pageViewport[@nr='7']//flow/block[2]/@border-before"/>
+    <eval expected=""                     xpath="//pageViewport[@nr='7']//flow/block[2]/@border-after"/>
+    <!-- header 1.1 -->
+    <eval expected="10000"                xpath="//pageViewport[@nr='7']//flow/block[2]/block[1]/@bpd"/>
+    <eval expected="14000"                xpath="//pageViewport[@nr='7']//flow/block[2]/block[1]/@bpda"/>
+    <eval expected="(solid,#0000ff,2000)" xpath="//pageViewport[@nr='7']//flow/block[2]/block[1]/@border-before"/>
+    <eval expected="(solid,#0000ff,2000)" xpath="//pageViewport[@nr='7']//flow/block[2]/block[1]/@border-after"/>
+    <!-- header 1.2 -->
+    <eval expected="10000"                xpath="//pageViewport[@nr='7']//flow/block[2]/block[2]/@bpd"/>
+    <eval expected="14000"                xpath="//pageViewport[@nr='7']//flow/block[2]/block[2]/@bpda"/>
+    <eval expected="(solid,#0000ff,2000)" xpath="//pageViewport[@nr='7']//flow/block[2]/block[2]/@border-before"/>
+    <eval expected="(solid,#0000ff,2000)" xpath="//pageViewport[@nr='7']//flow/block[2]/block[2]/@border-after"/>
+    <!-- cell 1.1 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='7']//flow/block[2]/block[3]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='7']//flow/block[2]/block[3]/@bpda"/>
+    <eval expected="(solid,#008000,2000)" xpath="//pageViewport[@nr='7']//flow/block[2]/block[3]/@border-before"/>
+    <eval expected="(solid,#008000,2000)" xpath="//pageViewport[@nr='7']//flow/block[2]/block[3]/@border-after"/>
+    <!-- cell 1.2 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='7']//flow/block[2]/block[4]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='7']//flow/block[2]/block[4]/@bpda"/>
+    <eval expected="(solid,#008000,2000)" xpath="//pageViewport[@nr='7']//flow/block[2]/block[4]/@border-before"/>
+    <eval expected="(solid,#008000,2000)" xpath="//pageViewport[@nr='7']//flow/block[2]/block[4]/@border-after"/>
+    <!-- cell 2.1 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='7']//flow/block[2]/block[5]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='7']//flow/block[2]/block[5]/@bpda"/>
+    <eval expected="(solid,#ff0000,2000)" xpath="//pageViewport[@nr='7']//flow/block[2]/block[5]/@border-before"/>
+    <eval expected="(solid,#ff0000,2000)" xpath="//pageViewport[@nr='7']//flow/block[2]/block[5]/@border-after"/>
+    <!-- cell 2.2 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='7']//flow/block[2]/block[6]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='7']//flow/block[2]/block[6]/@bpda"/>
+    <eval expected="(solid,#ff0000,2000)" xpath="//pageViewport[@nr='7']//flow/block[2]/block[6]/@border-before"/>
+    <eval expected="(solid,#ff0000,2000)" xpath="//pageViewport[@nr='7']//flow/block[2]/block[6]/@border-after"/>
+    <!-- page 2 -->
+    <eval expected="2"                    xpath="count(//pageViewport[@nr='8']//flow/block)"/>
+    <eval expected="After the table"      xpath="//pageViewport[@nr='8']//flow/block[2]//text"/>
+    <eval expected="38000"                xpath="//pageViewport[@nr='8']//flow/block[1]/@bpd"/>
+    <eval expected="40000"                xpath="//pageViewport[@nr='8']//flow/block[1]/@bpda"/>
+    <eval expected=""                     xpath="//pageViewport[@nr='8']//flow/block[1]/@border-before"/>
+    <eval expected="(solid,#000000,2000)" xpath="//pageViewport[@nr='8']//flow/block[1]/@border-after"/>
+    <!-- cell 3.1 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='8']//flow/block[1]/block[1]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='8']//flow/block[1]/block[1]/@bpda"/>
+    <eval expected="(solid,#ffa500,2000)" xpath="//pageViewport[@nr='8']//flow/block[1]/block[1]/@border-before"/>
+    <eval expected="(solid,#ffa500,2000)" xpath="//pageViewport[@nr='8']//flow/block[1]/block[1]/@border-after"/>
+    <!-- cell 3.2 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='8']//flow/block[1]/block[2]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='8']//flow/block[1]/block[2]/@bpda"/>
+    <eval expected="(solid,#ffa500,2000)" xpath="//pageViewport[@nr='8']//flow/block[1]/block[2]/@border-before"/>
+    <eval expected="(solid,#ffa500,2000)" xpath="//pageViewport[@nr='8']//flow/block[1]/block[2]/@border-after"/>
+    <!-- footer 1.1 -->
+    <eval expected="10000"                xpath="//pageViewport[@nr='8']//flow/block[1]/block[3]/@bpd"/>
+    <eval expected="14000"                xpath="//pageViewport[@nr='8']//flow/block[1]/block[3]/@bpda"/>
+    <eval expected="(solid,#800080,2000)" xpath="//pageViewport[@nr='8']//flow/block[1]/block[3]/@border-before"/>
+    <eval expected="(solid,#800080,2000)" xpath="//pageViewport[@nr='8']//flow/block[1]/block[3]/@border-after"/>
+    <!-- footer 1.2 -->
+    <eval expected="10000"                xpath="//pageViewport[@nr='8']//flow/block[1]/block[4]/@bpd"/>
+    <eval expected="14000"                xpath="//pageViewport[@nr='8']//flow/block[1]/block[4]/@bpda"/>
+    <eval expected="(solid,#800080,2000)" xpath="//pageViewport[@nr='8']//flow/block[1]/block[4]/@border-before"/>
+    <eval expected="(solid,#800080,2000)" xpath="//pageViewport[@nr='8']//flow/block[1]/block[4]/@border-after"/>
+
+    <!-- 5. separate border model, retained borders, omitted header/footer -->
+    <!-- page 1 -->
+    <eval expected="2"                    xpath="count(//pageSequence[5]/pageViewport)"/>
+    <eval expected="2"                    xpath="count(//pageViewport[@nr='9']//flow/block)"/>
+    <eval expected="5. Before the table"  xpath="//pageViewport[@nr='9']//flow/block[1]//text"/>
+    <eval expected="62000"                xpath="//pageViewport[@nr='9']//flow/block[2]/@bpd"/>
+    <eval expected="66000"                xpath="//pageViewport[@nr='9']//flow/block[2]/@bpda"/>
+    <eval expected="(solid,#000000,2000)" xpath="//pageViewport[@nr='9']//flow/block[2]/@border-before"/>
+    <eval expected="(solid,#000000,2000)" xpath="//pageViewport[@nr='9']//flow/block[2]/@border-after"/>
+    <!-- header 1.1 -->
+    <eval expected="10000"                xpath="//pageViewport[@nr='9']//flow/block[2]/block[1]/@bpd"/>
+    <eval expected="14000"                xpath="//pageViewport[@nr='9']//flow/block[2]/block[1]/@bpda"/>
+    <eval expected="(solid,#0000ff,2000)" xpath="//pageViewport[@nr='9']//flow/block[2]/block[1]/@border-before"/>
+    <eval expected="(solid,#0000ff,2000)" xpath="//pageViewport[@nr='9']//flow/block[2]/block[1]/@border-after"/>
+    <!-- header 1.2 -->
+    <eval expected="10000"                xpath="//pageViewport[@nr='9']//flow/block[2]/block[2]/@bpd"/>
+    <eval expected="14000"                xpath="//pageViewport[@nr='9']//flow/block[2]/block[2]/@bpda"/>
+    <eval expected="(solid,#0000ff,2000)" xpath="//pageViewport[@nr='9']//flow/block[2]/block[2]/@border-before"/>
+    <eval expected="(solid,#0000ff,2000)" xpath="//pageViewport[@nr='9']//flow/block[2]/block[2]/@border-after"/>
+    <!-- cell 1.1 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='9']//flow/block[2]/block[3]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='9']//flow/block[2]/block[3]/@bpda"/>
+    <eval expected="(solid,#008000,2000)" xpath="//pageViewport[@nr='9']//flow/block[2]/block[3]/@border-before"/>
+    <eval expected="(solid,#008000,2000)" xpath="//pageViewport[@nr='9']//flow/block[2]/block[3]/@border-after"/>
+    <!-- cell 1.2 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='9']//flow/block[2]/block[4]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='9']//flow/block[2]/block[4]/@bpda"/>
+    <eval expected="(solid,#008000,2000)" xpath="//pageViewport[@nr='9']//flow/block[2]/block[4]/@border-before"/>
+    <eval expected="(solid,#008000,2000)" xpath="//pageViewport[@nr='9']//flow/block[2]/block[4]/@border-after"/>
+    <!-- cell 2.1 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='9']//flow/block[2]/block[5]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='9']//flow/block[2]/block[5]/@bpda"/>
+    <eval expected="(solid,#ff0000,2000)" xpath="//pageViewport[@nr='9']//flow/block[2]/block[5]/@border-before"/>
+    <eval expected="(solid,#ff0000,2000)" xpath="//pageViewport[@nr='9']//flow/block[2]/block[5]/@border-after"/>
+    <!-- cell 2.2 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='9']//flow/block[2]/block[6]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='9']//flow/block[2]/block[6]/@bpda"/>
+    <eval expected="(solid,#ff0000,2000)" xpath="//pageViewport[@nr='9']//flow/block[2]/block[6]/@border-before"/>
+    <eval expected="(solid,#ff0000,2000)" xpath="//pageViewport[@nr='9']//flow/block[2]/block[6]/@border-after"/>
+    <!-- page 2 -->
+    <eval expected="2"                    xpath="count(//pageViewport[@nr='10']//flow/block)"/>
+    <eval expected="After the table"      xpath="//pageViewport[@nr='10']//flow/block[2]//text"/>
+    <eval expected="38000"                xpath="//pageViewport[@nr='10']//flow/block[1]/@bpd"/>
+    <eval expected="42000"                xpath="//pageViewport[@nr='10']//flow/block[1]/@bpda"/>
+    <eval expected="(solid,#000000,2000)" xpath="//pageViewport[@nr='10']//flow/block[1]/@border-before"/>
+    <eval expected="(solid,#000000,2000)" xpath="//pageViewport[@nr='10']//flow/block[1]/@border-after"/>
+    <!-- cell 3.1 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='10']//flow/block[1]/block[1]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='10']//flow/block[1]/block[1]/@bpda"/>
+    <eval expected="(solid,#ffa500,2000)" xpath="//pageViewport[@nr='10']//flow/block[1]/block[1]/@border-before"/>
+    <eval expected="(solid,#ffa500,2000)" xpath="//pageViewport[@nr='10']//flow/block[1]/block[1]/@border-after"/>
+    <!-- cell 3.2 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='10']//flow/block[1]/block[2]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='10']//flow/block[1]/block[2]/@bpda"/>
+    <eval expected="(solid,#ffa500,2000)" xpath="//pageViewport[@nr='10']//flow/block[1]/block[2]/@border-before"/>
+    <eval expected="(solid,#ffa500,2000)" xpath="//pageViewport[@nr='10']//flow/block[1]/block[2]/@border-after"/>
+    <!-- footer 1.1 -->
+    <eval expected="10000"                xpath="//pageViewport[@nr='10']//flow/block[1]/block[3]/@bpd"/>
+    <eval expected="14000"                xpath="//pageViewport[@nr='10']//flow/block[1]/block[3]/@bpda"/>
+    <eval expected="(solid,#800080,2000)" xpath="//pageViewport[@nr='10']//flow/block[1]/block[3]/@border-before"/>
+    <eval expected="(solid,#800080,2000)" xpath="//pageViewport[@nr='10']//flow/block[1]/block[3]/@border-after"/>
+    <!-- footer 1.2 -->
+    <eval expected="10000"                xpath="//pageViewport[@nr='10']//flow/block[1]/block[4]/@bpd"/>
+    <eval expected="14000"                xpath="//pageViewport[@nr='10']//flow/block[1]/block[4]/@bpda"/>
+    <eval expected="(solid,#800080,2000)" xpath="//pageViewport[@nr='10']//flow/block[1]/block[4]/@border-before"/>
+    <eval expected="(solid,#800080,2000)" xpath="//pageViewport[@nr='10']//flow/block[1]/block[4]/@border-after"/>
+
+    <!-- 6. collapsing border model, discarded borders, no header/footer -->
+    <!-- page 1 -->
+    <eval expected="2"                                   xpath="count(//pageSequence[6]/pageViewport)"/>
+    <eval expected="2"                                   xpath="count(//pageViewport[@nr='11']//flow/block)"/>
+    <eval expected="6. Before the table"                 xpath="//pageViewport[@nr='11']//flow/block[1]//text"/>
+    <eval expected="44000"                               xpath="//pageViewport[@nr='11']//flow/block[2]/@bpd"/>
+    <eval expected="44000"                               xpath="//pageViewport[@nr='11']//flow/block[2]/@bpda"/>
+    <!-- cell 1.1 -->
+    <eval expected="20000"                               xpath="//pageViewport[@nr='11']//flow/block[2]/block[1]/@bpd"/>
+    <eval expected="24000"                               xpath="//pageViewport[@nr='11']//flow/block[2]/block[1]/@bpda"/>
+    <eval expected="(solid,#008000,2000,collapse-outer)" xpath="//pageViewport[@nr='11']//flow/block[2]/block[1]/@border-before"/>
+    <eval expected="(solid,#008000,2000,collapse-inner)" xpath="//pageViewport[@nr='11']//flow/block[2]/block[1]/@border-after"/>
+    <!-- cell 1.2 -->
+    <eval expected="20000"                               xpath="//pageViewport[@nr='11']//flow/block[2]/block[2]/@bpd"/>
+    <eval expected="24000"                               xpath="//pageViewport[@nr='11']//flow/block[2]/block[2]/@bpda"/>
+    <eval expected="(solid,#008000,2000,collapse-outer)" xpath="//pageViewport[@nr='11']//flow/block[2]/block[2]/@border-before"/>
+    <eval expected="(solid,#008000,2000,collapse-inner)" xpath="//pageViewport[@nr='11']//flow/block[2]/block[2]/@border-after"/>
+    <!-- cell 2.1 -->
+    <eval expected="20000"                               xpath="//pageViewport[@nr='11']//flow/block[2]/block[3]/@bpd"/>
+    <eval expected="24000"                               xpath="//pageViewport[@nr='11']//flow/block[2]/block[3]/@bpda"/>
+    <eval expected="(solid,#ff0000,2000,collapse-inner)" xpath="//pageViewport[@nr='11']//flow/block[2]/block[3]/@border-before"/>
+    <eval expected="(solid,#ff0000,2000,collapse-outer)" xpath="//pageViewport[@nr='11']//flow/block[2]/block[3]/@border-after"/>
+    <!-- cell 2.2 -->
+    <eval expected="20000"                               xpath="//pageViewport[@nr='11']//flow/block[2]/block[4]/@bpd"/>
+    <eval expected="24000"                               xpath="//pageViewport[@nr='11']//flow/block[2]/block[4]/@bpda"/>
+    <eval expected="(solid,#ff0000,2000,collapse-inner)" xpath="//pageViewport[@nr='11']//flow/block[2]/block[4]/@border-before"/>
+    <eval expected="(solid,#ff0000,2000,collapse-outer)" xpath="//pageViewport[@nr='11']//flow/block[2]/block[4]/@border-after"/>
+    <!-- page 2 -->
+    <eval expected="2"                                   xpath="count(//pageViewport[@nr='12']//flow/block)"/>
+    <eval expected="After the table"                     xpath="//pageViewport[@nr='12']//flow/block[2]//text"/>
+    <eval expected="22000"                               xpath="//pageViewport[@nr='12']//flow/block[1]/@bpd"/>
+    <eval expected="22000"                               xpath="//pageViewport[@nr='12']//flow/block[1]/@bpda"/>
+    <!-- cell 3.1 -->
+    <eval expected="20000"                               xpath="//pageViewport[@nr='12']//flow/block[1]/block[1]/@bpd"/>
+    <eval expected="24000"                               xpath="//pageViewport[@nr='12']//flow/block[1]/block[1]/@bpda"/>
+    <eval expected="(solid,#ffa500,2000,collapse-outer)" xpath="//pageViewport[@nr='12']//flow/block[1]/block[1]/@border-before"/>
+    <eval expected="(solid,#ffa500,2000,collapse-outer)" xpath="//pageViewport[@nr='12']//flow/block[1]/block[1]/@border-after"/>
+    <!-- cell 3.2 -->
+    <eval expected="20000"                               xpath="//pageViewport[@nr='12']//flow/block[1]/block[2]/@bpd"/>
+    <eval expected="24000"                               xpath="//pageViewport[@nr='12']//flow/block[1]/block[2]/@bpda"/>
+    <eval expected="(solid,#ffa500,2000,collapse-outer)" xpath="//pageViewport[@nr='12']//flow/block[1]/block[2]/@border-before"/>
+    <eval expected="(solid,#ffa500,2000,collapse-outer)" xpath="//pageViewport[@nr='12']//flow/block[1]/block[2]/@border-after"/>
+
+    <!-- 7. collapsing border model, discarded borders, repeated header/footer -->
+    <!-- page 1 -->
+    <eval expected="2"                                   xpath="count(//pageSequence[7]/pageViewport)"/>
+    <eval expected="2"                                   xpath="count(//pageViewport[@nr='13']//flow/block)"/>
+    <eval expected="7. Before the table"                 xpath="//pageViewport[@nr='13']//flow/block[1]//text"/>
+    <eval expected="68000"                               xpath="//pageViewport[@nr='13']//flow/block[2]/@bpd"/>
+    <eval expected="68000"                               xpath="//pageViewport[@nr='13']//flow/block[2]/@bpda"/>
+    <!-- header 1.1 -->
+    <eval expected="10000"                               xpath="//pageViewport[@nr='13']//flow/block[2]/block[1]/@bpd"/>
+    <eval expected="14000"                               xpath="//pageViewport[@nr='13']//flow/block[2]/block[1]/@bpda"/>
+    <eval expected="(solid,#0000ff,2000,collapse-outer)" xpath="//pageViewport[@nr='13']//flow/block[2]/block[1]/@border-before"/>
+    <eval expected="(solid,#0000ff,2000,collapse-inner)" xpath="//pageViewport[@nr='13']//flow/block[2]/block[1]/@border-after"/>
+    <!-- header 1.2 -->
+    <eval expected="10000"                               xpath="//pageViewport[@nr='13']//flow/block[2]/block[2]/@bpd"/>
+    <eval expected="14000"                               xpath="//pageViewport[@nr='13']//flow/block[2]/block[2]/@bpda"/>
+    <eval expected="(solid,#0000ff,2000,collapse-outer)" xpath="//pageViewport[@nr='13']//flow/block[2]/block[2]/@border-before"/>
+    <eval expected="(solid,#0000ff,2000,collapse-inner)" xpath="//pageViewport[@nr='13']//flow/block[2]/block[2]/@border-after"/>
+    <!-- cell 1.1 -->
+    <eval expected="20000"                               xpath="//pageViewport[@nr='13']//flow/block[2]/block[3]/@bpd"/>
+    <eval expected="24000"                               xpath="//pageViewport[@nr='13']//flow/block[2]/block[3]/@bpda"/>
+    <eval expected="(solid,#008000,2000,collapse-inner)" xpath="//pageViewport[@nr='13']//flow/block[2]/block[3]/@border-before"/>
+    <eval expected="(solid,#008000,2000,collapse-inner)" xpath="//pageViewport[@nr='13']//flow/block[2]/block[3]/@border-after"/>
+    <!-- cell 1.2 -->
+    <eval expected="20000"                               xpath="//pageViewport[@nr='13']//flow/block[2]/block[4]/@bpd"/>
+    <eval expected="24000"                               xpath="//pageViewport[@nr='13']//flow/block[2]/block[4]/@bpda"/>
+    <eval expected="(solid,#008000,2000,collapse-inner)" xpath="//pageViewport[@nr='13']//flow/block[2]/block[4]/@border-before"/>
+    <eval expected="(solid,#008000,2000,collapse-inner)" xpath="//pageViewport[@nr='13']//flow/block[2]/block[4]/@border-after"/>
+    <!-- cell 2.1 -->
+    <eval expected="20000"                               xpath="//pageViewport[@nr='13']//flow/block[2]/block[5]/@bpd"/>
+    <eval expected="24000"                               xpath="//pageViewport[@nr='13']//flow/block[2]/block[5]/@bpda"/>
+    <eval expected="(solid,#ff0000,2000,collapse-inner)" xpath="//pageViewport[@nr='13']//flow/block[2]/block[5]/@border-before"/>
+    <eval expected="(solid,#ff0000,2000,collapse-inner)" xpath="//pageViewport[@nr='13']//flow/block[2]/block[5]/@border-after"/>
+    <!-- cell 2.2 -->
+    <eval expected="20000"                               xpath="//pageViewport[@nr='13']//flow/block[2]/block[6]/@bpd"/>
+    <eval expected="24000"                               xpath="//pageViewport[@nr='13']//flow/block[2]/block[6]/@bpda"/>
+    <eval expected="(solid,#ff0000,2000,collapse-inner)" xpath="//pageViewport[@nr='13']//flow/block[2]/block[6]/@border-before"/>
+    <eval expected="(solid,#ff0000,2000,collapse-inner)" xpath="//pageViewport[@nr='13']//flow/block[2]/block[6]/@border-after"/>
+    <!-- footer 1.1 -->
+    <eval expected="10000"                               xpath="//pageViewport[@nr='13']//flow/block[2]/block[7]/@bpd"/>
+    <eval expected="14000"                               xpath="//pageViewport[@nr='13']//flow/block[2]/block[7]/@bpda"/>
+    <eval expected="(solid,#800080,2000,collapse-inner)" xpath="//pageViewport[@nr='13']//flow/block[2]/block[7]/@border-before"/>
+    <eval expected="(solid,#800080,2000,collapse-outer)" xpath="//pageViewport[@nr='13']//flow/block[2]/block[7]/@border-after"/>
+    <!-- footer 1.2 -->
+    <eval expected="10000"                               xpath="//pageViewport[@nr='13']//flow/block[2]/block[8]/@bpd"/>
+    <eval expected="14000"                               xpath="//pageViewport[@nr='13']//flow/block[2]/block[8]/@bpda"/>
+    <eval expected="(solid,#800080,2000,collapse-inner)" xpath="//pageViewport[@nr='13']//flow/block[2]/block[8]/@border-before"/>
+    <eval expected="(solid,#800080,2000,collapse-outer)" xpath="//pageViewport[@nr='13']//flow/block[2]/block[8]/@border-after"/>
+    <!-- page 2 -->
+    <eval expected="2"                                   xpath="count(//pageViewport[@nr='14']//flow/block)"/>
+    <eval expected="After the table"                     xpath="//pageViewport[@nr='14']//flow/block[2]//text"/>
+    <eval expected="46000"                               xpath="//pageViewport[@nr='14']//flow/block[1]/@bpd"/>
+    <eval expected="46000"                               xpath="//pageViewport[@nr='14']//flow/block[1]/@bpda"/>
+    <!-- header 1.1 -->
+    <eval expected="10000"                               xpath="//pageViewport[@nr='14']//flow/block[1]/block[1]/@bpd"/>
+    <eval expected="14000"                               xpath="//pageViewport[@nr='14']//flow/block[1]/block[1]/@bpda"/>
+    <eval expected="(solid,#0000ff,2000,collapse-outer)" xpath="//pageViewport[@nr='14']//flow/block[1]/block[1]/@border-before"/>
+    <eval expected="(solid,#0000ff,2000,collapse-inner)" xpath="//pageViewport[@nr='14']//flow/block[1]/block[1]/@border-after"/>
+    <!-- header 1.2 -->
+    <eval expected="10000"                               xpath="//pageViewport[@nr='14']//flow/block[1]/block[2]/@bpd"/>
+    <eval expected="14000"                               xpath="//pageViewport[@nr='14']//flow/block[1]/block[2]/@bpda"/>
+    <eval expected="(solid,#0000ff,2000,collapse-outer)" xpath="//pageViewport[@nr='14']//flow/block[1]/block[2]/@border-before"/>
+    <eval expected="(solid,#0000ff,2000,collapse-inner)" xpath="//pageViewport[@nr='14']//flow/block[1]/block[2]/@border-after"/>
+    <!-- cell 3.1 -->
+    <eval expected="20000"                               xpath="//pageViewport[@nr='14']//flow/block[1]/block[3]/@bpd"/>
+    <eval expected="24000"                               xpath="//pageViewport[@nr='14']//flow/block[1]/block[3]/@bpda"/>
+    <eval expected="(solid,#ffa500,2000,collapse-inner)" xpath="//pageViewport[@nr='14']//flow/block[1]/block[3]/@border-before"/>
+    <eval expected="(solid,#ffa500,2000,collapse-inner)" xpath="//pageViewport[@nr='14']//flow/block[1]/block[3]/@border-after"/>
+    <!-- cell 3.2 -->
+    <eval expected="20000"                               xpath="//pageViewport[@nr='14']//flow/block[1]/block[4]/@bpd"/>
+    <eval expected="24000"                               xpath="//pageViewport[@nr='14']//flow/block[1]/block[4]/@bpda"/>
+    <eval expected="(solid,#ffa500,2000,collapse-inner)" xpath="//pageViewport[@nr='14']//flow/block[1]/block[4]/@border-before"/>
+    <eval expected="(solid,#ffa500,2000,collapse-inner)" xpath="//pageViewport[@nr='14']//flow/block[1]/block[4]/@border-after"/>
+    <!-- footer 1.1 -->
+    <eval expected="10000"                               xpath="//pageViewport[@nr='14']//flow/block[1]/block[5]/@bpd"/>
+    <eval expected="14000"                               xpath="//pageViewport[@nr='14']//flow/block[1]/block[5]/@bpda"/>
+    <eval expected="(solid,#800080,2000,collapse-inner)" xpath="//pageViewport[@nr='14']//flow/block[1]/block[5]/@border-before"/>
+    <eval expected="(solid,#800080,2000,collapse-outer)" xpath="//pageViewport[@nr='14']//flow/block[1]/block[5]/@border-after"/>
+    <!-- footer 1.2 -->
+    <eval expected="10000"                               xpath="//pageViewport[@nr='14']//flow/block[1]/block[6]/@bpd"/>
+    <eval expected="14000"                               xpath="//pageViewport[@nr='14']//flow/block[1]/block[6]/@bpda"/>
+    <eval expected="(solid,#800080,2000,collapse-inner)" xpath="//pageViewport[@nr='14']//flow/block[1]/block[6]/@border-before"/>
+    <eval expected="(solid,#800080,2000,collapse-outer)" xpath="//pageViewport[@nr='14']//flow/block[1]/block[6]/@border-after"/>
+
+    <!-- 8. collapsing border model, discarded borders, omitted header/footer -->
+    <!-- page 1 -->
+    <eval expected="2"                                   xpath="count(//pageSequence[8]/pageViewport)"/>
+    <eval expected="2"                                   xpath="count(//pageViewport[@nr='15']//flow/block)"/>
+    <eval expected="8. Before the table"                 xpath="//pageViewport[@nr='15']//flow/block[1]//text"/>
+    <eval expected="56000"                               xpath="//pageViewport[@nr='15']//flow/block[2]/@bpd"/>
+    <eval expected="56000"                               xpath="//pageViewport[@nr='15']//flow/block[2]/@bpda"/>
+    <!-- header 1.1 -->
+    <eval expected="10000"                               xpath="//pageViewport[@nr='15']//flow/block[2]/block[1]/@bpd"/>
+    <eval expected="14000"                               xpath="//pageViewport[@nr='15']//flow/block[2]/block[1]/@bpda"/>
+    <eval expected="(solid,#0000ff,2000,collapse-outer)" xpath="//pageViewport[@nr='15']//flow/block[2]/block[1]/@border-before"/>
+    <eval expected="(solid,#0000ff,2000,collapse-inner)" xpath="//pageViewport[@nr='15']//flow/block[2]/block[1]/@border-after"/>
+    <!-- header 1.2 -->
+    <eval expected="10000"                               xpath="//pageViewport[@nr='15']//flow/block[2]/block[2]/@bpd"/>
+    <eval expected="14000"                               xpath="//pageViewport[@nr='15']//flow/block[2]/block[2]/@bpda"/>
+    <eval expected="(solid,#0000ff,2000,collapse-outer)" xpath="//pageViewport[@nr='15']//flow/block[2]/block[2]/@border-before"/>
+    <eval expected="(solid,#0000ff,2000,collapse-inner)" xpath="//pageViewport[@nr='15']//flow/block[2]/block[2]/@border-after"/>
+    <!-- cell 1.1 -->
+    <eval expected="20000"                               xpath="//pageViewport[@nr='15']//flow/block[2]/block[3]/@bpd"/>
+    <eval expected="24000"                               xpath="//pageViewport[@nr='15']//flow/block[2]/block[3]/@bpda"/>
+    <eval expected="(solid,#008000,2000,collapse-inner)" xpath="//pageViewport[@nr='15']//flow/block[2]/block[3]/@border-before"/>
+    <eval expected="(solid,#008000,2000,collapse-inner)" xpath="//pageViewport[@nr='15']//flow/block[2]/block[3]/@border-after"/>
+    <!-- cell 1.2 -->
+    <eval expected="20000"                               xpath="//pageViewport[@nr='15']//flow/block[2]/block[4]/@bpd"/>
+    <eval expected="24000"                               xpath="//pageViewport[@nr='15']//flow/block[2]/block[4]/@bpda"/>
+    <eval expected="(solid,#008000,2000,collapse-inner)" xpath="//pageViewport[@nr='15']//flow/block[2]/block[4]/@border-before"/>
+    <eval expected="(solid,#008000,2000,collapse-inner)" xpath="//pageViewport[@nr='15']//flow/block[2]/block[4]/@border-after"/>
+    <!-- cell 2.1 -->
+    <eval expected="20000"                               xpath="//pageViewport[@nr='15']//flow/block[2]/block[5]/@bpd"/>
+    <eval expected="24000"                               xpath="//pageViewport[@nr='15']//flow/block[2]/block[5]/@bpda"/>
+    <eval expected="(solid,#ff0000,2000,collapse-inner)" xpath="//pageViewport[@nr='15']//flow/block[2]/block[5]/@border-before"/>
+    <eval expected="(solid,#ff0000,2000,collapse-outer)" xpath="//pageViewport[@nr='15']//flow/block[2]/block[5]/@border-after"/>
+    <!-- cell 2.2 -->
+    <eval expected="20000"                               xpath="//pageViewport[@nr='15']//flow/block[2]/block[6]/@bpd"/>
+    <eval expected="24000"                               xpath="//pageViewport[@nr='15']//flow/block[2]/block[6]/@bpda"/>
+    <eval expected="(solid,#ff0000,2000,collapse-inner)" xpath="//pageViewport[@nr='15']//flow/block[2]/block[6]/@border-before"/>
+    <eval expected="(solid,#ff0000,2000,collapse-outer)" xpath="//pageViewport[@nr='15']//flow/block[2]/block[6]/@border-after"/>
+    <!-- page 2 -->
+    <eval expected="2"                                   xpath="count(//pageViewport[@nr='16']//flow/block)"/>
+    <eval expected="After the table"                     xpath="//pageViewport[@nr='16']//flow/block[2]//text"/>
+    <eval expected="34000"                               xpath="//pageViewport[@nr='16']//flow/block[1]/@bpd"/>
+    <eval expected="34000"                               xpath="//pageViewport[@nr='16']//flow/block[1]/@bpda"/>
+    <!-- cell 3.1 -->
+    <eval expected="20000"                               xpath="//pageViewport[@nr='16']//flow/block[1]/block[1]/@bpd"/>
+    <eval expected="24000"                               xpath="//pageViewport[@nr='16']//flow/block[1]/block[1]/@bpda"/>
+    <eval expected="(solid,#ffa500,2000,collapse-outer)" xpath="//pageViewport[@nr='16']//flow/block[1]/block[1]/@border-before"/>
+    <eval expected="(solid,#ffa500,2000,collapse-inner)" xpath="//pageViewport[@nr='16']//flow/block[1]/block[1]/@border-after"/>
+    <!-- cell 3.2 -->
+    <eval expected="20000"                               xpath="//pageViewport[@nr='16']//flow/block[1]/block[2]/@bpd"/>
+    <eval expected="24000"                               xpath="//pageViewport[@nr='16']//flow/block[1]/block[2]/@bpda"/>
+    <eval expected="(solid,#ffa500,2000,collapse-outer)" xpath="//pageViewport[@nr='16']//flow/block[1]/block[2]/@border-before"/>
+    <eval expected="(solid,#ffa500,2000,collapse-inner)" xpath="//pageViewport[@nr='16']//flow/block[1]/block[2]/@border-after"/>
+    <!-- footer 1.1 -->
+    <eval expected="10000"                               xpath="//pageViewport[@nr='16']//flow/block[1]/block[3]/@bpd"/>
+    <eval expected="14000"                               xpath="//pageViewport[@nr='16']//flow/block[1]/block[3]/@bpda"/>
+    <eval expected="(solid,#800080,2000,collapse-inner)" xpath="//pageViewport[@nr='16']//flow/block[1]/block[3]/@border-before"/>
+    <eval expected="(solid,#800080,2000,collapse-outer)" xpath="//pageViewport[@nr='16']//flow/block[1]/block[3]/@border-after"/>
+    <!-- footer 1.2 -->
+    <eval expected="10000"                               xpath="//pageViewport[@nr='16']//flow/block[1]/block[4]/@bpd"/>
+    <eval expected="14000"                               xpath="//pageViewport[@nr='16']//flow/block[1]/block[4]/@bpda"/>
+    <eval expected="(solid,#800080,2000,collapse-inner)" xpath="//pageViewport[@nr='16']//flow/block[1]/block[4]/@border-before"/>
+    <eval expected="(solid,#800080,2000,collapse-outer)" xpath="//pageViewport[@nr='16']//flow/block[1]/block[4]/@border-after"/>
+
+  </checks>
+</testcase>
diff --git a/test/layoutengine/standard-testcases/table-cell_break-after_last-row.xml b/test/layoutengine/standard-testcases/table-cell_break-after_last-row.xml
new file mode 100644 (file)
index 0000000..290d8de
--- /dev/null
@@ -0,0 +1,688 @@
+<?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 that break-after set on blocks in table-cells works correctly in various
+      conditions: when headers/footers shall be repeated at page breaks or not, in the separate or
+      collapsing border model, etc.
+    </p>
+  </info>
+  <fo>
+    <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
+      <fo:layout-master-set>
+        <fo:simple-page-master master-name="page" page-height="10cm" page-width="15cm" margin="1cm">
+          <fo:region-body background-color="#F0F0F0"/>
+        </fo:simple-page-master>
+      </fo:layout-master-set>
+
+      <!-- 1. separate border model, discarded borders, no header/footer -->
+      <fo:page-sequence master-reference="page" font-size="8pt" line-height="10pt">
+        <fo:flow flow-name="xsl-region-body">
+          <fo:block>1. Before the table</fo:block>
+          <fo:table width="100%" table-layout="fixed"
+            border-collapse="separate" border="2pt solid black">
+            <fo:table-column column-width="proportional-column-width(1)" number-columns-repeated="2"/>
+            <fo:table-body>
+              <fo:table-row border="2pt solid green">
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 1.1</fo:block>
+                  <fo:block>Cell 1.1</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 1.2</fo:block>
+                  <fo:block>Cell 1.2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+              <fo:table-row border="2pt solid red">
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 2.1</fo:block>
+                  <fo:block>Cell 2.1</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 2.2</fo:block>
+                  <fo:block>Cell 2.2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+              <fo:table-row border="2pt solid orange">
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 3.1</fo:block>
+                  <fo:block break-after="page">Cell 3.1</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 3.2</fo:block>
+                  <fo:block>Cell 3.2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+            </fo:table-body>
+          </fo:table>
+          <fo:block>After the table</fo:block>
+        </fo:flow>
+      </fo:page-sequence>
+
+      <!-- 2. separate border model, discarded borders, repeated header/footer -->
+      <fo:page-sequence master-reference="page" font-size="8pt" line-height="10pt">
+        <fo:flow flow-name="xsl-region-body">
+          <fo:block>2. Before the table</fo:block>
+          <fo:table width="100%" table-layout="fixed"
+            border-collapse="separate" border="2pt solid black"
+            table-omit-header-at-break="false" table-omit-footer-at-break="false">
+            <fo:table-column column-width="proportional-column-width(1)" number-columns-repeated="2"/>
+            <fo:table-header>
+              <fo:table-row border="2pt solid blue">
+                <fo:table-cell border="inherit"><fo:block>Header 1.1</fo:block></fo:table-cell>
+                <fo:table-cell border="inherit"><fo:block>Header 1.2</fo:block></fo:table-cell>
+              </fo:table-row>
+            </fo:table-header>
+            <fo:table-footer>
+              <fo:table-row border="2pt solid purple">
+                <fo:table-cell border="inherit"><fo:block>Footer 1.1</fo:block></fo:table-cell>
+                <fo:table-cell border="inherit"><fo:block>Footer 1.2</fo:block></fo:table-cell>
+              </fo:table-row>
+            </fo:table-footer>
+            <fo:table-body>
+              <fo:table-row border="2pt solid green">
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 1.1</fo:block>
+                  <fo:block>Cell 1.1</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 1.2</fo:block>
+                  <fo:block>Cell 1.2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+              <fo:table-row border="2pt solid red">
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 2.1</fo:block>
+                  <fo:block>Cell 2.1</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 2.2</fo:block>
+                  <fo:block>Cell 2.2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+              <fo:table-row border="2pt solid orange">
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 3.1</fo:block>
+                  <fo:block break-after="page">Cell 3.1</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 3.2</fo:block>
+                  <fo:block>Cell 3.2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+            </fo:table-body>
+          </fo:table>
+          <fo:block>After the table</fo:block>
+        </fo:flow>
+      </fo:page-sequence>
+
+      <!-- 3. separate border model, discarded borders, omitted header/footer -->
+      <fo:page-sequence master-reference="page" font-size="8pt" line-height="10pt">
+        <fo:flow flow-name="xsl-region-body">
+          <fo:block>3. Before the table</fo:block>
+          <fo:table width="100%" table-layout="fixed"
+            border-collapse="separate" border="2pt solid black"
+            table-omit-header-at-break="true" table-omit-footer-at-break="true">
+            <fo:table-column column-width="proportional-column-width(1)" number-columns-repeated="2"/>
+            <fo:table-header>
+              <fo:table-row border="2pt solid blue">
+                <fo:table-cell border="inherit"><fo:block>Header 1.1</fo:block></fo:table-cell>
+                <fo:table-cell border="inherit"><fo:block>Header 1.2</fo:block></fo:table-cell>
+              </fo:table-row>
+            </fo:table-header>
+            <fo:table-footer>
+              <fo:table-row border="2pt solid purple">
+                <fo:table-cell border="inherit"><fo:block>Footer 1.1</fo:block></fo:table-cell>
+                <fo:table-cell border="inherit"><fo:block>Footer 1.2</fo:block></fo:table-cell>
+              </fo:table-row>
+            </fo:table-footer>
+            <fo:table-body>
+              <fo:table-row border="2pt solid green">
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 1.1</fo:block>
+                  <fo:block>Cell 1.1</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 1.2</fo:block>
+                  <fo:block>Cell 1.2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+              <fo:table-row border="2pt solid red">
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 2.1</fo:block>
+                  <fo:block>Cell 2.1</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 2.2</fo:block>
+                  <fo:block>Cell 2.2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+              <fo:table-row border="2pt solid orange">
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 3.1</fo:block>
+                  <fo:block>Cell 3.1</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 3.2</fo:block>
+                  <fo:block break-after="page">Cell 3.2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+            </fo:table-body>
+          </fo:table>
+          <fo:block>After the table</fo:block>
+        </fo:flow>
+      </fo:page-sequence>
+
+      <!-- 4. collapsing border model, discarded borders, no header/footer -->
+      <fo:page-sequence master-reference="page" font-size="8pt" line-height="10pt">
+        <fo:flow flow-name="xsl-region-body">
+          <fo:block>4. Before the table</fo:block>
+          <fo:table width="100%" table-layout="fixed"
+            border-collapse="collapse" border="2pt solid black">
+            <fo:table-column column-width="proportional-column-width(1)" number-columns-repeated="2"/>
+            <fo:table-body>
+              <fo:table-row border="2pt solid green">
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 1.1</fo:block>
+                  <fo:block>Cell 1.1</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 1.2</fo:block>
+                  <fo:block>Cell 1.2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+              <fo:table-row border="2pt solid red">
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 2.1</fo:block>
+                  <fo:block>Cell 2.1</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 2.2</fo:block>
+                  <fo:block>Cell 2.2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+              <fo:table-row border="2pt solid orange">
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 3.1</fo:block>
+                  <fo:block break-after="page">Cell 3.1</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 3.2</fo:block>
+                  <fo:block>Cell 3.2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+            </fo:table-body>
+          </fo:table>
+          <fo:block>After the table</fo:block>
+        </fo:flow>
+      </fo:page-sequence>
+
+      <!-- 5. collapsing border model, discarded borders, repeated header/footer -->
+      <fo:page-sequence master-reference="page" font-size="8pt" line-height="10pt">
+        <fo:flow flow-name="xsl-region-body">
+          <fo:block>5. Before the table</fo:block>
+          <fo:table width="100%" table-layout="fixed"
+            border-collapse="collapse" border="2pt solid black"
+            table-omit-header-at-break="false" table-omit-footer-at-break="false">
+            <fo:table-column column-width="proportional-column-width(1)" number-columns-repeated="2"/>
+            <fo:table-header>
+              <fo:table-row border="2pt solid blue">
+                <fo:table-cell border="inherit"><fo:block>Header 1.1</fo:block></fo:table-cell>
+                <fo:table-cell border="inherit"><fo:block>Header 1.2</fo:block></fo:table-cell>
+              </fo:table-row>
+            </fo:table-header>
+            <fo:table-footer>
+              <fo:table-row border="2pt solid purple">
+                <fo:table-cell border="inherit"><fo:block>Footer 1.1</fo:block></fo:table-cell>
+                <fo:table-cell border="inherit"><fo:block>Footer 1.2</fo:block></fo:table-cell>
+              </fo:table-row>
+            </fo:table-footer>
+            <fo:table-body>
+              <fo:table-row border="2pt solid green">
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 1.1</fo:block>
+                  <fo:block>Cell 1.1</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 1.2</fo:block>
+                  <fo:block>Cell 1.2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+              <fo:table-row border="2pt solid red">
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 2.1</fo:block>
+                  <fo:block>Cell 2.1</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 2.2</fo:block>
+                  <fo:block>Cell 2.2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+              <fo:table-row border="2pt solid orange">
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 3.1</fo:block>
+                  <fo:block>Cell 3.1</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 3.2</fo:block>
+                  <fo:block break-after="page">Cell 3.2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+            </fo:table-body>
+          </fo:table>
+          <fo:block>After the table</fo:block>
+        </fo:flow>
+      </fo:page-sequence>
+
+      <!-- 6. collapsing border model, discarded borders, omitted header/footer -->
+      <fo:page-sequence master-reference="page" font-size="8pt" line-height="10pt">
+        <fo:flow flow-name="xsl-region-body">
+          <fo:block>6. Before the table</fo:block>
+          <fo:table width="100%" table-layout="fixed"
+            border-collapse="collapse" border="2pt solid black"
+            table-omit-header-at-break="true" table-omit-footer-at-break="true">
+            <fo:table-column column-width="proportional-column-width(1)" number-columns-repeated="2"/>
+            <fo:table-header>
+              <fo:table-row border="2pt solid blue">
+                <fo:table-cell border="inherit"><fo:block>Header 1.1</fo:block></fo:table-cell>
+                <fo:table-cell border="inherit"><fo:block>Header 1.2</fo:block></fo:table-cell>
+              </fo:table-row>
+            </fo:table-header>
+            <fo:table-footer>
+              <fo:table-row border="2pt solid purple">
+                <fo:table-cell border="inherit"><fo:block>Footer 1.1</fo:block></fo:table-cell>
+                <fo:table-cell border="inherit"><fo:block>Footer 1.2</fo:block></fo:table-cell>
+              </fo:table-row>
+            </fo:table-footer>
+            <fo:table-body>
+              <fo:table-row border="2pt solid green">
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 1.1</fo:block>
+                  <fo:block>Cell 1.1</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 1.2</fo:block>
+                  <fo:block>Cell 1.2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+              <fo:table-row border="2pt solid red">
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 2.1</fo:block>
+                  <fo:block>Cell 2.1</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 2.2</fo:block>
+                  <fo:block>Cell 2.2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+              <fo:table-row border="2pt solid orange">
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 3.1</fo:block>
+                  <fo:block break-after="page">Cell 3.1</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 3.2</fo:block>
+                  <fo:block>Cell 3.2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+            </fo:table-body>
+          </fo:table>
+          <fo:block>After the table</fo:block>
+        </fo:flow>
+      </fo:page-sequence>
+
+    </fo:root>
+  </fo>
+  <checks>
+
+    <!-- 1. separate border model, discarded borders, no header/footer -->
+    <!-- page 1 -->
+    <eval expected="2"                    xpath="count(//pageSequence[1]/pageViewport)"/>
+    <eval expected="2"                    xpath="count(//pageViewport[@nr='1']//flow/block)"/>
+    <eval expected="1. Before the table"  xpath="//pageViewport[@nr='1']//flow/block[1]//text"/>
+    <eval expected="72000"                xpath="//pageViewport[@nr='1']//flow/block[2]/@bpd"/>
+    <!--eval expected="76000"                xpath="//pageViewport[@nr='1']//flow/block[2]/@bpda"/-->
+    <eval expected="(solid,#000000,2000)" xpath="//pageViewport[@nr='1']//flow/block[2]/@border-before"/>
+    <!--eval expected="(solid,#000000,2000)" xpath="//pageViewport[@nr='1']//flow/block[2]/@border-after"/-->
+    <!-- cell 1.1 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='1']//flow/block[2]/block[1]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='1']//flow/block[2]/block[1]/@bpda"/>
+    <eval expected="(solid,#008000,2000)" xpath="//pageViewport[@nr='1']//flow/block[2]/block[1]/@border-before"/>
+    <eval expected="(solid,#008000,2000)" xpath="//pageViewport[@nr='1']//flow/block[2]/block[1]/@border-after"/>
+    <!-- cell 1.2 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='1']//flow/block[2]/block[2]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='1']//flow/block[2]/block[2]/@bpda"/>
+    <eval expected="(solid,#008000,2000)" xpath="//pageViewport[@nr='1']//flow/block[2]/block[2]/@border-before"/>
+    <eval expected="(solid,#008000,2000)" xpath="//pageViewport[@nr='1']//flow/block[2]/block[2]/@border-after"/>
+    <!-- cell 2.1 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='1']//flow/block[2]/block[3]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='1']//flow/block[2]/block[3]/@bpda"/>
+    <eval expected="(solid,#ff0000,2000)" xpath="//pageViewport[@nr='1']//flow/block[2]/block[3]/@border-before"/>
+    <eval expected="(solid,#ff0000,2000)" xpath="//pageViewport[@nr='1']//flow/block[2]/block[3]/@border-after"/>
+    <!-- cell 2.2 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='1']//flow/block[2]/block[4]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='1']//flow/block[2]/block[4]/@bpda"/>
+    <eval expected="(solid,#ff0000,2000)" xpath="//pageViewport[@nr='1']//flow/block[2]/block[4]/@border-before"/>
+    <eval expected="(solid,#ff0000,2000)" xpath="//pageViewport[@nr='1']//flow/block[2]/block[4]/@border-after"/>
+    <!-- cell 3.1 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='1']//flow/block[2]/block[5]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='1']//flow/block[2]/block[5]/@bpda"/>
+    <eval expected="(solid,#ffa500,2000)" xpath="//pageViewport[@nr='1']//flow/block[2]/block[5]/@border-before"/>
+    <eval expected="(solid,#ffa500,2000)" xpath="//pageViewport[@nr='1']//flow/block[2]/block[5]/@border-after"/>
+    <!-- cell 3.2 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='1']//flow/block[2]/block[6]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='1']//flow/block[2]/block[6]/@bpda"/>
+    <eval expected="(solid,#ffa500,2000)" xpath="//pageViewport[@nr='1']//flow/block[2]/block[6]/@border-before"/>
+    <eval expected="(solid,#ffa500,2000)" xpath="//pageViewport[@nr='1']//flow/block[2]/block[6]/@border-after"/>
+    <!-- page 2 -->
+    <eval expected="1"                    xpath="count(//pageViewport[@nr='2']//flow/block)"/>
+    <eval expected="After the table"      xpath="//pageViewport[@nr='2']//flow/block[1]//text"/>
+
+    <!-- 2. separate border model, discarded borders, repeated header/footer -->
+    <!-- page 1 -->
+    <eval expected="2"                    xpath="count(//pageSequence[2]/pageViewport)"/>
+    <eval expected="2"                    xpath="count(//pageViewport[@nr='3']//flow/block)"/>
+    <eval expected="2. Before the table"  xpath="//pageViewport[@nr='3']//flow/block[1]//text"/>
+    <eval expected="100000"               xpath="//pageViewport[@nr='3']//flow/block[2]/@bpd"/>
+    <!--eval expected="104000"               xpath="//pageViewport[@nr='3']//flow/block[2]/@bpda"/-->
+    <eval expected="(solid,#000000,2000)" xpath="//pageViewport[@nr='3']//flow/block[2]/@border-before"/>
+    <!--eval expected="(solid,#000000,2000)" xpath="//pageViewport[@nr='3']//flow/block[2]/@border-after"/-->
+    <!-- header 1.1 -->
+    <eval expected="10000"                xpath="//pageViewport[@nr='3']//flow/block[2]/block[1]/@bpd"/>
+    <eval expected="14000"                xpath="//pageViewport[@nr='3']//flow/block[2]/block[1]/@bpda"/>
+    <eval expected="(solid,#0000ff,2000)" xpath="//pageViewport[@nr='3']//flow/block[2]/block[1]/@border-before"/>
+    <eval expected="(solid,#0000ff,2000)" xpath="//pageViewport[@nr='3']//flow/block[2]/block[1]/@border-after"/>
+    <!-- header 1.2 -->
+    <eval expected="10000"                xpath="//pageViewport[@nr='3']//flow/block[2]/block[2]/@bpd"/>
+    <eval expected="14000"                xpath="//pageViewport[@nr='3']//flow/block[2]/block[2]/@bpda"/>
+    <eval expected="(solid,#0000ff,2000)" xpath="//pageViewport[@nr='3']//flow/block[2]/block[2]/@border-before"/>
+    <eval expected="(solid,#0000ff,2000)" xpath="//pageViewport[@nr='3']//flow/block[2]/block[2]/@border-after"/>
+    <!-- cell 1.1 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='3']//flow/block[2]/block[3]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='3']//flow/block[2]/block[3]/@bpda"/>
+    <eval expected="(solid,#008000,2000)" xpath="//pageViewport[@nr='3']//flow/block[2]/block[3]/@border-before"/>
+    <eval expected="(solid,#008000,2000)" xpath="//pageViewport[@nr='3']//flow/block[2]/block[3]/@border-after"/>
+    <!-- cell 1.2 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='3']//flow/block[2]/block[4]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='3']//flow/block[2]/block[4]/@bpda"/>
+    <eval expected="(solid,#008000,2000)" xpath="//pageViewport[@nr='3']//flow/block[2]/block[4]/@border-before"/>
+    <eval expected="(solid,#008000,2000)" xpath="//pageViewport[@nr='3']//flow/block[2]/block[4]/@border-after"/>
+    <!-- cell 2.1 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='3']//flow/block[2]/block[5]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='3']//flow/block[2]/block[5]/@bpda"/>
+    <eval expected="(solid,#ff0000,2000)" xpath="//pageViewport[@nr='3']//flow/block[2]/block[5]/@border-before"/>
+    <eval expected="(solid,#ff0000,2000)" xpath="//pageViewport[@nr='3']//flow/block[2]/block[5]/@border-after"/>
+    <!-- cell 2.2 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='3']//flow/block[2]/block[6]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='3']//flow/block[2]/block[6]/@bpda"/>
+    <eval expected="(solid,#ff0000,2000)" xpath="//pageViewport[@nr='3']//flow/block[2]/block[6]/@border-before"/>
+    <eval expected="(solid,#ff0000,2000)" xpath="//pageViewport[@nr='3']//flow/block[2]/block[6]/@border-after"/>
+    <!-- cell 3.1 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='3']//flow/block[2]/block[7]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='3']//flow/block[2]/block[7]/@bpda"/>
+    <eval expected="(solid,#ffa500,2000)" xpath="//pageViewport[@nr='3']//flow/block[2]/block[7]/@border-before"/>
+    <eval expected="(solid,#ffa500,2000)" xpath="//pageViewport[@nr='3']//flow/block[2]/block[7]/@border-after"/>
+    <!-- cell 3.2 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='3']//flow/block[2]/block[8]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='3']//flow/block[2]/block[8]/@bpda"/>
+    <eval expected="(solid,#ffa500,2000)" xpath="//pageViewport[@nr='3']//flow/block[2]/block[8]/@border-before"/>
+    <eval expected="(solid,#ffa500,2000)" xpath="//pageViewport[@nr='3']//flow/block[2]/block[8]/@border-after"/>
+    <!-- footer 1.1 -->
+    <eval expected="10000"                xpath="//pageViewport[@nr='3']//flow/block[2]/block[9]/@bpd"/>
+    <eval expected="14000"                xpath="//pageViewport[@nr='3']//flow/block[2]/block[9]/@bpda"/>
+    <eval expected="(solid,#800080,2000)" xpath="//pageViewport[@nr='3']//flow/block[2]/block[9]/@border-before"/>
+    <eval expected="(solid,#800080,2000)" xpath="//pageViewport[@nr='3']//flow/block[2]/block[9]/@border-after"/>
+    <!-- footer 1.2 -->
+    <eval expected="10000"                xpath="//pageViewport[@nr='3']//flow/block[2]/block[10]/@bpd"/>
+    <eval expected="14000"                xpath="//pageViewport[@nr='3']//flow/block[2]/block[10]/@bpda"/>
+    <eval expected="(solid,#800080,2000)" xpath="//pageViewport[@nr='3']//flow/block[2]/block[10]/@border-before"/>
+    <eval expected="(solid,#800080,2000)" xpath="//pageViewport[@nr='3']//flow/block[2]/block[10]/@border-after"/>
+    <!-- page 2 -->
+    <eval expected="1"                    xpath="count(//pageViewport[@nr='4']//flow/block)"/>
+    <eval expected="After the table"      xpath="//pageViewport[@nr='4']//flow/block[1]//text"/>
+
+    <!-- 3. separate border model, discarded borders, omitted header/footer -->
+    <!-- page 1 -->
+    <eval expected="2"                    xpath="count(//pageSequence[3]/pageViewport)"/>
+    <eval expected="2"                    xpath="count(//pageViewport[@nr='5']//flow/block)"/>
+    <eval expected="3. Before the table"  xpath="//pageViewport[@nr='5']//flow/block[1]//text"/>
+    <eval expected="100000"               xpath="//pageViewport[@nr='5']//flow/block[2]/@bpd"/>
+    <!--eval expected="104000"               xpath="//pageViewport[@nr='5']//flow/block[2]/@bpda"/-->
+    <eval expected="(solid,#000000,2000)" xpath="//pageViewport[@nr='5']//flow/block[2]/@border-before"/>
+    <!--eval expected="(solid,#000000,2000)" xpath="//pageViewport[@nr='5']//flow/block[2]/@border-after"/-->
+    <!-- header 1.1 -->
+    <eval expected="10000"                xpath="//pageViewport[@nr='5']//flow/block[2]/block[1]/@bpd"/>
+    <eval expected="14000"                xpath="//pageViewport[@nr='5']//flow/block[2]/block[1]/@bpda"/>
+    <eval expected="(solid,#0000ff,2000)" xpath="//pageViewport[@nr='5']//flow/block[2]/block[1]/@border-before"/>
+    <eval expected="(solid,#0000ff,2000)" xpath="//pageViewport[@nr='5']//flow/block[2]/block[1]/@border-after"/>
+    <!-- header 1.2 -->
+    <eval expected="10000"                xpath="//pageViewport[@nr='5']//flow/block[2]/block[2]/@bpd"/>
+    <eval expected="14000"                xpath="//pageViewport[@nr='5']//flow/block[2]/block[2]/@bpda"/>
+    <eval expected="(solid,#0000ff,2000)" xpath="//pageViewport[@nr='5']//flow/block[2]/block[2]/@border-before"/>
+    <eval expected="(solid,#0000ff,2000)" xpath="//pageViewport[@nr='5']//flow/block[2]/block[2]/@border-after"/>
+    <!-- cell 1.1 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='5']//flow/block[2]/block[3]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='5']//flow/block[2]/block[3]/@bpda"/>
+    <eval expected="(solid,#008000,2000)" xpath="//pageViewport[@nr='5']//flow/block[2]/block[3]/@border-before"/>
+    <eval expected="(solid,#008000,2000)" xpath="//pageViewport[@nr='5']//flow/block[2]/block[3]/@border-after"/>
+    <!-- cell 1.2 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='5']//flow/block[2]/block[4]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='5']//flow/block[2]/block[4]/@bpda"/>
+    <eval expected="(solid,#008000,2000)" xpath="//pageViewport[@nr='5']//flow/block[2]/block[4]/@border-before"/>
+    <eval expected="(solid,#008000,2000)" xpath="//pageViewport[@nr='5']//flow/block[2]/block[4]/@border-after"/>
+    <!-- cell 2.1 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='5']//flow/block[2]/block[5]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='5']//flow/block[2]/block[5]/@bpda"/>
+    <eval expected="(solid,#ff0000,2000)" xpath="//pageViewport[@nr='5']//flow/block[2]/block[5]/@border-before"/>
+    <eval expected="(solid,#ff0000,2000)" xpath="//pageViewport[@nr='5']//flow/block[2]/block[5]/@border-after"/>
+    <!-- cell 2.2 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='5']//flow/block[2]/block[6]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='5']//flow/block[2]/block[6]/@bpda"/>
+    <eval expected="(solid,#ff0000,2000)" xpath="//pageViewport[@nr='5']//flow/block[2]/block[6]/@border-before"/>
+    <eval expected="(solid,#ff0000,2000)" xpath="//pageViewport[@nr='5']//flow/block[2]/block[6]/@border-after"/>
+    <!-- cell 3.1 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='5']//flow/block[2]/block[7]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='5']//flow/block[2]/block[7]/@bpda"/>
+    <eval expected="(solid,#ffa500,2000)" xpath="//pageViewport[@nr='5']//flow/block[2]/block[7]/@border-before"/>
+    <eval expected="(solid,#ffa500,2000)" xpath="//pageViewport[@nr='5']//flow/block[2]/block[7]/@border-after"/>
+    <!-- cell 3.2 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='5']//flow/block[2]/block[8]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='5']//flow/block[2]/block[8]/@bpda"/>
+    <eval expected="(solid,#ffa500,2000)" xpath="//pageViewport[@nr='5']//flow/block[2]/block[8]/@border-before"/>
+    <eval expected="(solid,#ffa500,2000)" xpath="//pageViewport[@nr='5']//flow/block[2]/block[8]/@border-after"/>
+    <!-- footer 1.1 -->
+    <eval expected="10000"                xpath="//pageViewport[@nr='5']//flow/block[2]/block[9]/@bpd"/>
+    <eval expected="14000"                xpath="//pageViewport[@nr='5']//flow/block[2]/block[9]/@bpda"/>
+    <eval expected="(solid,#800080,2000)" xpath="//pageViewport[@nr='5']//flow/block[2]/block[9]/@border-before"/>
+    <eval expected="(solid,#800080,2000)" xpath="//pageViewport[@nr='5']//flow/block[2]/block[9]/@border-after"/>
+    <!-- footer 1.2 -->
+    <eval expected="10000"                xpath="//pageViewport[@nr='5']//flow/block[2]/block[10]/@bpd"/>
+    <eval expected="14000"                xpath="//pageViewport[@nr='5']//flow/block[2]/block[10]/@bpda"/>
+    <eval expected="(solid,#800080,2000)" xpath="//pageViewport[@nr='5']//flow/block[2]/block[10]/@border-before"/>
+    <eval expected="(solid,#800080,2000)" xpath="//pageViewport[@nr='5']//flow/block[2]/block[10]/@border-after"/>
+    <!-- page 2 -->
+    <eval expected="1"                    xpath="count(//pageViewport[@nr='6']//flow/block)"/>
+    <eval expected="After the table"      xpath="//pageViewport[@nr='6']//flow/block[1]//text"/>
+
+    <!-- 4. collapsing border model, discarded borders, no header/footer -->
+    <!-- page 1 -->
+    <eval expected="2"                                   xpath="count(//pageSequence[4]/pageViewport)"/>
+    <eval expected="2"                                   xpath="count(//pageViewport[@nr='7']//flow/block)"/>
+    <eval expected="4. Before the table"                 xpath="//pageViewport[@nr='7']//flow/block[1]//text"/>
+    <eval expected="66000"                               xpath="//pageViewport[@nr='7']//flow/block[2]/@bpd"/>
+    <eval expected="66000"                               xpath="//pageViewport[@nr='7']//flow/block[2]/@bpda"/>
+    <!-- cell 1.1 -->
+    <eval expected="20000"                               xpath="//pageViewport[@nr='7']//flow/block[2]/block[1]/@bpd"/>
+    <eval expected="24000"                               xpath="//pageViewport[@nr='7']//flow/block[2]/block[1]/@bpda"/>
+    <eval expected="(solid,#008000,2000,collapse-outer)" xpath="//pageViewport[@nr='7']//flow/block[2]/block[1]/@border-before"/>
+    <eval expected="(solid,#008000,2000,collapse-inner)" xpath="//pageViewport[@nr='7']//flow/block[2]/block[1]/@border-after"/>
+    <!-- cell 1.2 -->
+    <eval expected="20000"                               xpath="//pageViewport[@nr='7']//flow/block[2]/block[2]/@bpd"/>
+    <eval expected="24000"                               xpath="//pageViewport[@nr='7']//flow/block[2]/block[2]/@bpda"/>
+    <eval expected="(solid,#008000,2000,collapse-outer)" xpath="//pageViewport[@nr='7']//flow/block[2]/block[2]/@border-before"/>
+    <eval expected="(solid,#008000,2000,collapse-inner)" xpath="//pageViewport[@nr='7']//flow/block[2]/block[2]/@border-after"/>
+    <!-- cell 2.1 -->
+    <eval expected="20000"                               xpath="//pageViewport[@nr='7']//flow/block[2]/block[3]/@bpd"/>
+    <eval expected="24000"                               xpath="//pageViewport[@nr='7']//flow/block[2]/block[3]/@bpda"/>
+    <eval expected="(solid,#ff0000,2000,collapse-inner)" xpath="//pageViewport[@nr='7']//flow/block[2]/block[3]/@border-before"/>
+    <eval expected="(solid,#ff0000,2000,collapse-inner)" xpath="//pageViewport[@nr='7']//flow/block[2]/block[3]/@border-after"/>
+    <!-- cell 2.2 -->
+    <eval expected="20000"                               xpath="//pageViewport[@nr='7']//flow/block[2]/block[4]/@bpd"/>
+    <eval expected="24000"                               xpath="//pageViewport[@nr='7']//flow/block[2]/block[4]/@bpda"/>
+    <eval expected="(solid,#ff0000,2000,collapse-inner)" xpath="//pageViewport[@nr='7']//flow/block[2]/block[4]/@border-before"/>
+    <eval expected="(solid,#ff0000,2000,collapse-inner)" xpath="//pageViewport[@nr='7']//flow/block[2]/block[4]/@border-after"/>
+    <!-- cell 3.1 -->
+    <eval expected="20000"                               xpath="//pageViewport[@nr='7']//flow/block[2]/block[5]/@bpd"/>
+    <eval expected="24000"                               xpath="//pageViewport[@nr='7']//flow/block[2]/block[5]/@bpda"/>
+    <eval expected="(solid,#ffa500,2000,collapse-inner)" xpath="//pageViewport[@nr='7']//flow/block[2]/block[5]/@border-before"/>
+    <eval expected="(solid,#ffa500,2000,collapse-outer)" xpath="//pageViewport[@nr='7']//flow/block[2]/block[5]/@border-after"/>
+    <!-- cell 3.2 -->
+    <eval expected="20000"                               xpath="//pageViewport[@nr='7']//flow/block[2]/block[6]/@bpd"/>
+    <eval expected="24000"                               xpath="//pageViewport[@nr='7']//flow/block[2]/block[6]/@bpda"/>
+    <eval expected="(solid,#ffa500,2000,collapse-inner)" xpath="//pageViewport[@nr='7']//flow/block[2]/block[6]/@border-before"/>
+    <eval expected="(solid,#ffa500,2000,collapse-outer)" xpath="//pageViewport[@nr='7']//flow/block[2]/block[6]/@border-after"/>
+    <!-- page 2 -->
+    <eval expected="1"                                   xpath="count(//pageViewport[@nr='8']//flow/block)"/>
+    <eval expected="After the table"                     xpath="//pageViewport[@nr='8']//flow/block[1]//text"/>
+
+    <!-- 5. collapsing border model, discarded borders, repeated header/footer -->
+    <!-- page 1 -->
+    <eval expected="2"                                   xpath="count(//pageSequence[5]/pageViewport)"/>
+    <eval expected="2"                                   xpath="count(//pageViewport[@nr='9']//flow/block)"/>
+    <eval expected="5. Before the table"                 xpath="//pageViewport[@nr='9']//flow/block[1]//text"/>
+    <eval expected="90000"                               xpath="//pageViewport[@nr='9']//flow/block[2]/@bpd"/>
+    <eval expected="90000"                               xpath="//pageViewport[@nr='9']//flow/block[2]/@bpda"/>
+    <!-- header 1.1 -->
+    <eval expected="10000"                               xpath="//pageViewport[@nr='9']//flow/block[2]/block[1]/@bpd"/>
+    <eval expected="14000"                               xpath="//pageViewport[@nr='9']//flow/block[2]/block[1]/@bpda"/>
+    <eval expected="(solid,#0000ff,2000,collapse-outer)" xpath="//pageViewport[@nr='9']//flow/block[2]/block[1]/@border-before"/>
+    <eval expected="(solid,#0000ff,2000,collapse-inner)" xpath="//pageViewport[@nr='9']//flow/block[2]/block[1]/@border-after"/>
+    <!-- header 1.2 -->
+    <eval expected="10000"                               xpath="//pageViewport[@nr='9']//flow/block[2]/block[2]/@bpd"/>
+    <eval expected="14000"                               xpath="//pageViewport[@nr='9']//flow/block[2]/block[2]/@bpda"/>
+    <eval expected="(solid,#0000ff,2000,collapse-outer)" xpath="//pageViewport[@nr='9']//flow/block[2]/block[2]/@border-before"/>
+    <eval expected="(solid,#0000ff,2000,collapse-inner)" xpath="//pageViewport[@nr='9']//flow/block[2]/block[2]/@border-after"/>
+    <!-- cell 1.1 -->
+    <eval expected="20000"                               xpath="//pageViewport[@nr='9']//flow/block[2]/block[3]/@bpd"/>
+    <eval expected="24000"                               xpath="//pageViewport[@nr='9']//flow/block[2]/block[3]/@bpda"/>
+    <eval expected="(solid,#008000,2000,collapse-inner)" xpath="//pageViewport[@nr='9']//flow/block[2]/block[3]/@border-before"/>
+    <eval expected="(solid,#008000,2000,collapse-inner)" xpath="//pageViewport[@nr='9']//flow/block[2]/block[3]/@border-after"/>
+    <!-- cell 1.2 -->
+    <eval expected="20000"                               xpath="//pageViewport[@nr='9']//flow/block[2]/block[4]/@bpd"/>
+    <eval expected="24000"                               xpath="//pageViewport[@nr='9']//flow/block[2]/block[4]/@bpda"/>
+    <eval expected="(solid,#008000,2000,collapse-inner)" xpath="//pageViewport[@nr='9']//flow/block[2]/block[4]/@border-before"/>
+    <eval expected="(solid,#008000,2000,collapse-inner)" xpath="//pageViewport[@nr='9']//flow/block[2]/block[4]/@border-after"/>
+    <!-- cell 2.1 -->
+    <eval expected="20000"                               xpath="//pageViewport[@nr='9']//flow/block[2]/block[5]/@bpd"/>
+    <eval expected="24000"                               xpath="//pageViewport[@nr='9']//flow/block[2]/block[5]/@bpda"/>
+    <eval expected="(solid,#ff0000,2000,collapse-inner)" xpath="//pageViewport[@nr='9']//flow/block[2]/block[5]/@border-before"/>
+    <eval expected="(solid,#ff0000,2000,collapse-inner)" xpath="//pageViewport[@nr='9']//flow/block[2]/block[5]/@border-after"/>
+    <!-- cell 2.2 -->
+    <eval expected="20000"                               xpath="//pageViewport[@nr='9']//flow/block[2]/block[6]/@bpd"/>
+    <eval expected="24000"                               xpath="//pageViewport[@nr='9']//flow/block[2]/block[6]/@bpda"/>
+    <eval expected="(solid,#ff0000,2000,collapse-inner)" xpath="//pageViewport[@nr='9']//flow/block[2]/block[6]/@border-before"/>
+    <eval expected="(solid,#ff0000,2000,collapse-inner)" xpath="//pageViewport[@nr='9']//flow/block[2]/block[6]/@border-after"/>
+    <!-- cell 3.1 -->
+    <eval expected="20000"                               xpath="//pageViewport[@nr='9']//flow/block[2]/block[7]/@bpd"/>
+    <eval expected="24000"                               xpath="//pageViewport[@nr='9']//flow/block[2]/block[7]/@bpda"/>
+    <eval expected="(solid,#ffa500,2000,collapse-inner)" xpath="//pageViewport[@nr='9']//flow/block[2]/block[7]/@border-before"/>
+    <eval expected="(solid,#ffa500,2000,collapse-inner)" xpath="//pageViewport[@nr='9']//flow/block[2]/block[7]/@border-after"/>
+    <!-- cell 3.2 -->
+    <eval expected="20000"                               xpath="//pageViewport[@nr='9']//flow/block[2]/block[8]/@bpd"/>
+    <eval expected="24000"                               xpath="//pageViewport[@nr='9']//flow/block[2]/block[8]/@bpda"/>
+    <eval expected="(solid,#ffa500,2000,collapse-inner)" xpath="//pageViewport[@nr='9']//flow/block[2]/block[8]/@border-before"/>
+    <eval expected="(solid,#ffa500,2000,collapse-inner)" xpath="//pageViewport[@nr='9']//flow/block[2]/block[8]/@border-after"/>
+    <!-- footer 1.1 -->
+    <eval expected="10000"                               xpath="//pageViewport[@nr='9']//flow/block[2]/block[9]/@bpd"/>
+    <eval expected="14000"                               xpath="//pageViewport[@nr='9']//flow/block[2]/block[9]/@bpda"/>
+    <eval expected="(solid,#800080,2000,collapse-inner)" xpath="//pageViewport[@nr='9']//flow/block[2]/block[9]/@border-before"/>
+    <eval expected="(solid,#800080,2000,collapse-outer)" xpath="//pageViewport[@nr='9']//flow/block[2]/block[9]/@border-after"/>
+    <!-- footer 1.2 -->
+    <eval expected="10000"                               xpath="//pageViewport[@nr='9']//flow/block[2]/block[10]/@bpd"/>
+    <eval expected="14000"                               xpath="//pageViewport[@nr='9']//flow/block[2]/block[10]/@bpda"/>
+    <eval expected="(solid,#800080,2000,collapse-inner)" xpath="//pageViewport[@nr='9']//flow/block[2]/block[10]/@border-before"/>
+    <eval expected="(solid,#800080,2000,collapse-outer)" xpath="//pageViewport[@nr='9']//flow/block[2]/block[10]/@border-after"/>
+    <!-- page 2 -->
+    <eval expected="1"                                   xpath="count(//pageViewport[@nr='10']//flow/block)"/>
+    <eval expected="After the table"                     xpath="//pageViewport[@nr='10']//flow/block[1]//text"/>
+
+    <!-- 6. collapsing border model, discarded borders, omitted header/footer -->
+    <!-- page 1 -->
+    <eval expected="2"                                   xpath="count(//pageSequence[6]/pageViewport)"/>
+    <eval expected="2"                                   xpath="count(//pageViewport[@nr='11']//flow/block)"/>
+    <eval expected="6. Before the table"                 xpath="//pageViewport[@nr='11']//flow/block[1]//text"/>
+    <eval expected="90000"                               xpath="//pageViewport[@nr='11']//flow/block[2]/@bpd"/>
+    <eval expected="90000"                               xpath="//pageViewport[@nr='11']//flow/block[2]/@bpda"/>
+    <!-- header 1.1 -->
+    <eval expected="10000"                               xpath="//pageViewport[@nr='11']//flow/block[2]/block[1]/@bpd"/>
+    <eval expected="14000"                               xpath="//pageViewport[@nr='11']//flow/block[2]/block[1]/@bpda"/>
+    <eval expected="(solid,#0000ff,2000,collapse-outer)" xpath="//pageViewport[@nr='11']//flow/block[2]/block[1]/@border-before"/>
+    <eval expected="(solid,#0000ff,2000,collapse-inner)" xpath="//pageViewport[@nr='11']//flow/block[2]/block[1]/@border-after"/>
+    <!-- header 1.2 -->
+    <eval expected="10000"                               xpath="//pageViewport[@nr='11']//flow/block[2]/block[2]/@bpd"/>
+    <eval expected="14000"                               xpath="//pageViewport[@nr='11']//flow/block[2]/block[2]/@bpda"/>
+    <eval expected="(solid,#0000ff,2000,collapse-outer)" xpath="//pageViewport[@nr='11']//flow/block[2]/block[2]/@border-before"/>
+    <eval expected="(solid,#0000ff,2000,collapse-inner)" xpath="//pageViewport[@nr='11']//flow/block[2]/block[2]/@border-after"/>
+    <!-- cell 1.1 -->
+    <eval expected="20000"                               xpath="//pageViewport[@nr='11']//flow/block[2]/block[3]/@bpd"/>
+    <eval expected="24000"                               xpath="//pageViewport[@nr='11']//flow/block[2]/block[3]/@bpda"/>
+    <eval expected="(solid,#008000,2000,collapse-inner)" xpath="//pageViewport[@nr='11']//flow/block[2]/block[3]/@border-before"/>
+    <eval expected="(solid,#008000,2000,collapse-inner)" xpath="//pageViewport[@nr='11']//flow/block[2]/block[3]/@border-after"/>
+    <!-- cell 1.2 -->
+    <eval expected="20000"                               xpath="//pageViewport[@nr='11']//flow/block[2]/block[4]/@bpd"/>
+    <eval expected="24000"                               xpath="//pageViewport[@nr='11']//flow/block[2]/block[4]/@bpda"/>
+    <eval expected="(solid,#008000,2000,collapse-inner)" xpath="//pageViewport[@nr='11']//flow/block[2]/block[4]/@border-before"/>
+    <eval expected="(solid,#008000,2000,collapse-inner)" xpath="//pageViewport[@nr='11']//flow/block[2]/block[4]/@border-after"/>
+    <!-- cell 2.1 -->
+    <eval expected="20000"                               xpath="//pageViewport[@nr='11']//flow/block[2]/block[5]/@bpd"/>
+    <eval expected="24000"                               xpath="//pageViewport[@nr='11']//flow/block[2]/block[5]/@bpda"/>
+    <eval expected="(solid,#ff0000,2000,collapse-inner)" xpath="//pageViewport[@nr='11']//flow/block[2]/block[5]/@border-before"/>
+    <eval expected="(solid,#ff0000,2000,collapse-inner)" xpath="//pageViewport[@nr='11']//flow/block[2]/block[5]/@border-after"/>
+    <!-- cell 2.2 -->
+    <eval expected="20000"                               xpath="//pageViewport[@nr='11']//flow/block[2]/block[6]/@bpd"/>
+    <eval expected="24000"                               xpath="//pageViewport[@nr='11']//flow/block[2]/block[6]/@bpda"/>
+    <eval expected="(solid,#ff0000,2000,collapse-inner)" xpath="//pageViewport[@nr='11']//flow/block[2]/block[6]/@border-before"/>
+    <eval expected="(solid,#ff0000,2000,collapse-inner)" xpath="//pageViewport[@nr='11']//flow/block[2]/block[6]/@border-after"/>
+    <!-- cell 3.1 -->
+    <eval expected="20000"                               xpath="//pageViewport[@nr='11']//flow/block[2]/block[7]/@bpd"/>
+    <eval expected="24000"                               xpath="//pageViewport[@nr='11']//flow/block[2]/block[7]/@bpda"/>
+    <eval expected="(solid,#ffa500,2000,collapse-inner)" xpath="//pageViewport[@nr='11']//flow/block[2]/block[7]/@border-before"/>
+    <eval expected="(solid,#ffa500,2000,collapse-inner)" xpath="//pageViewport[@nr='11']//flow/block[2]/block[7]/@border-after"/>
+    <!-- cell 3.2 -->
+    <eval expected="20000"                               xpath="//pageViewport[@nr='11']//flow/block[2]/block[8]/@bpd"/>
+    <eval expected="24000"                               xpath="//pageViewport[@nr='11']//flow/block[2]/block[8]/@bpda"/>
+    <eval expected="(solid,#ffa500,2000,collapse-inner)" xpath="//pageViewport[@nr='11']//flow/block[2]/block[8]/@border-before"/>
+    <eval expected="(solid,#ffa500,2000,collapse-inner)" xpath="//pageViewport[@nr='11']//flow/block[2]/block[8]/@border-after"/>
+    <!-- footer 1.1 -->
+    <eval expected="10000"                               xpath="//pageViewport[@nr='11']//flow/block[2]/block[9]/@bpd"/>
+    <eval expected="14000"                               xpath="//pageViewport[@nr='11']//flow/block[2]/block[9]/@bpda"/>
+    <eval expected="(solid,#800080,2000,collapse-inner)" xpath="//pageViewport[@nr='11']//flow/block[2]/block[9]/@border-before"/>
+    <eval expected="(solid,#800080,2000,collapse-outer)" xpath="//pageViewport[@nr='11']//flow/block[2]/block[9]/@border-after"/>
+    <!-- footer 1.2 -->
+    <eval expected="10000"                               xpath="//pageViewport[@nr='11']//flow/block[2]/block[10]/@bpd"/>
+    <eval expected="14000"                               xpath="//pageViewport[@nr='11']//flow/block[2]/block[10]/@bpda"/>
+    <eval expected="(solid,#800080,2000,collapse-inner)" xpath="//pageViewport[@nr='11']//flow/block[2]/block[10]/@border-before"/>
+    <eval expected="(solid,#800080,2000,collapse-outer)" xpath="//pageViewport[@nr='11']//flow/block[2]/block[10]/@border-after"/>
+    <!-- page 2 -->
+    <eval expected="1"                                   xpath="count(//pageViewport[@nr='12']//flow/block)"/>
+    <eval expected="After the table"                     xpath="//pageViewport[@nr='12']//flow/block[1]//text"/>
+
+  </checks>
+</testcase>
diff --git a/test/layoutengine/standard-testcases/table-cell_break-before.xml b/test/layoutengine/standard-testcases/table-cell_break-before.xml
new file mode 100644 (file)
index 0000000..8371afd
--- /dev/null
@@ -0,0 +1,1018 @@
+<?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 that break-before set on blocks in table-cells works correctly in various
+      conditions: when headers/footers shall be repeated at page breaks or not, in the separate or
+      collapsing border model, etc.
+    </p>
+  </info>
+  <fo>
+    <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
+      <fo:layout-master-set>
+        <fo:simple-page-master master-name="page" page-height="10cm" page-width="15cm" margin="1cm">
+          <fo:region-body background-color="#F0F0F0"/>
+        </fo:simple-page-master>
+      </fo:layout-master-set>
+
+      <!-- 1. separate border model, discarded borders, no header/footer -->
+      <fo:page-sequence master-reference="page" font-size="8pt" line-height="10pt">
+        <fo:flow flow-name="xsl-region-body">
+          <fo:block>1. Before the table</fo:block>
+          <fo:table width="100%" table-layout="fixed"
+            border-collapse="separate" border="2pt solid black">
+            <fo:table-column column-width="proportional-column-width(1)" number-columns-repeated="2"/>
+            <fo:table-body>
+              <fo:table-row border="2pt solid green">
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 1.1</fo:block>
+                  <fo:block>Cell 1.1</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 1.2</fo:block>
+                  <fo:block>Cell 1.2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+              <fo:table-row border="2pt solid red">
+                <fo:table-cell border="inherit">
+                  <fo:block break-before="page">Cell 2.1</fo:block>
+                  <fo:block>Cell 2.1</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 2.2</fo:block>
+                  <fo:block>Cell 2.2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+              <fo:table-row border="2pt solid orange">
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 3.1</fo:block>
+                  <fo:block>Cell 3.1</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 3.2</fo:block>
+                  <fo:block>Cell 3.2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+            </fo:table-body>
+          </fo:table>
+          <fo:block>After the table</fo:block>
+        </fo:flow>
+      </fo:page-sequence>
+
+      <!-- 2. separate border model, discarded borders, repeated header/footer -->
+      <fo:page-sequence master-reference="page" font-size="8pt" line-height="10pt">
+        <fo:flow flow-name="xsl-region-body">
+          <fo:block>2. Before the table</fo:block>
+          <fo:table width="100%" table-layout="fixed"
+            border-collapse="separate" border="2pt solid black"
+            table-omit-header-at-break="false" table-omit-footer-at-break="false">
+            <fo:table-column column-width="proportional-column-width(1)" number-columns-repeated="2"/>
+            <fo:table-header>
+              <fo:table-row border="2pt solid blue">
+                <fo:table-cell border="inherit"><fo:block>Header 1.1</fo:block></fo:table-cell>
+                <fo:table-cell border="inherit"><fo:block>Header 1.2</fo:block></fo:table-cell>
+              </fo:table-row>
+            </fo:table-header>
+            <fo:table-footer>
+              <fo:table-row border="2pt solid purple">
+                <fo:table-cell border="inherit"><fo:block>Footer 1.1</fo:block></fo:table-cell>
+                <fo:table-cell border="inherit"><fo:block>Footer 1.2</fo:block></fo:table-cell>
+              </fo:table-row>
+            </fo:table-footer>
+            <fo:table-body>
+              <fo:table-row border="2pt solid green">
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 1.1</fo:block>
+                  <fo:block>Cell 1.1</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 1.2</fo:block>
+                  <fo:block>Cell 1.2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+              <fo:table-row border="2pt solid red">
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 2.1</fo:block>
+                  <fo:block>Cell 2.1</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="inherit">
+                  <fo:block break-before="page">Cell 2.2</fo:block>
+                  <fo:block>Cell 2.2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+              <fo:table-row border="2pt solid orange">
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 3.1</fo:block>
+                  <fo:block>Cell 3.1</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 3.2</fo:block>
+                  <fo:block>Cell 3.2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+            </fo:table-body>
+          </fo:table>
+          <fo:block>After the table</fo:block>
+        </fo:flow>
+      </fo:page-sequence>
+
+      <!-- 3. separate border model, retained borders, repeated header/footer -->
+      <fo:page-sequence master-reference="page" font-size="8pt" line-height="10pt">
+        <fo:flow flow-name="xsl-region-body">
+          <fo:block>3. Before the table</fo:block>
+          <fo:table width="100%" table-layout="fixed"
+            border-collapse="separate" border="2pt solid black"
+            border-before-width.length="2pt" border-before-width.conditionality="retain"
+            border-after-width.length="2pt" border-after-width.conditionality="retain"
+            table-omit-header-at-break="false" table-omit-footer-at-break="false">
+            <fo:table-column column-width="proportional-column-width(1)" number-columns-repeated="2"/>
+            <fo:table-header>
+              <fo:table-row border="2pt solid blue">
+                <fo:table-cell border="inherit"><fo:block>Header 1.1</fo:block></fo:table-cell>
+                <fo:table-cell border="inherit"><fo:block>Header 1.2</fo:block></fo:table-cell>
+              </fo:table-row>
+            </fo:table-header>
+            <fo:table-footer>
+              <fo:table-row border="2pt solid purple">
+                <fo:table-cell border="inherit"><fo:block>Footer 1.1</fo:block></fo:table-cell>
+                <fo:table-cell border="inherit"><fo:block>Footer 1.2</fo:block></fo:table-cell>
+              </fo:table-row>
+            </fo:table-footer>
+            <fo:table-body>
+              <fo:table-row border="2pt solid green">
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 1.1</fo:block>
+                  <fo:block>Cell 1.1</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 1.2</fo:block>
+                  <fo:block>Cell 1.2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+              <fo:table-row border="2pt solid red">
+                <fo:table-cell border="inherit">
+                  <fo:block break-before="page">Cell 2.1</fo:block>
+                  <fo:block>Cell 2.1</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 2.2</fo:block>
+                  <fo:block>Cell 2.2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+              <fo:table-row border="2pt solid orange">
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 3.1</fo:block>
+                  <fo:block>Cell 3.1</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 3.2</fo:block>
+                  <fo:block>Cell 3.2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+            </fo:table-body>
+          </fo:table>
+          <fo:block>After the table</fo:block>
+        </fo:flow>
+      </fo:page-sequence>
+
+      <!-- 4. separate border model, discarded borders, omitted header/footer -->
+      <fo:page-sequence master-reference="page" font-size="8pt" line-height="10pt">
+        <fo:flow flow-name="xsl-region-body">
+          <fo:block>4. Before the table</fo:block>
+          <fo:table width="100%" table-layout="fixed"
+            border-collapse="separate" border="2pt solid black"
+            table-omit-header-at-break="true" table-omit-footer-at-break="true">
+            <fo:table-column column-width="proportional-column-width(1)" number-columns-repeated="2"/>
+            <fo:table-header>
+              <fo:table-row border="2pt solid blue">
+                <fo:table-cell border="inherit"><fo:block>Header 1.1</fo:block></fo:table-cell>
+                <fo:table-cell border="inherit"><fo:block>Header 1.2</fo:block></fo:table-cell>
+              </fo:table-row>
+            </fo:table-header>
+            <fo:table-footer>
+              <fo:table-row border="2pt solid purple">
+                <fo:table-cell border="inherit"><fo:block>Footer 1.1</fo:block></fo:table-cell>
+                <fo:table-cell border="inherit"><fo:block>Footer 1.2</fo:block></fo:table-cell>
+              </fo:table-row>
+            </fo:table-footer>
+            <fo:table-body>
+              <fo:table-row border="2pt solid green">
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 1.1</fo:block>
+                  <fo:block>Cell 1.1</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 1.2</fo:block>
+                  <fo:block>Cell 1.2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+              <fo:table-row border="2pt solid red">
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 2.1</fo:block>
+                  <fo:block>Cell 2.1</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="inherit">
+                  <fo:block break-before="page">Cell 2.2</fo:block>
+                  <fo:block>Cell 2.2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+              <fo:table-row border="2pt solid orange">
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 3.1</fo:block>
+                  <fo:block>Cell 3.1</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 3.2</fo:block>
+                  <fo:block>Cell 3.2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+            </fo:table-body>
+          </fo:table>
+          <fo:block>After the table</fo:block>
+        </fo:flow>
+      </fo:page-sequence>
+
+      <!-- 5. separate border model, retained borders, omitted header/footer -->
+      <fo:page-sequence master-reference="page" font-size="8pt" line-height="10pt">
+        <fo:flow flow-name="xsl-region-body">
+          <fo:block>5. Before the table</fo:block>
+          <fo:table width="100%" table-layout="fixed"
+            border-collapse="separate" border="2pt solid black"
+            border-before-width.length="2pt" border-before-width.conditionality="retain"
+            border-after-width.length="2pt" border-after-width.conditionality="retain"
+            table-omit-header-at-break="true" table-omit-footer-at-break="true">
+            <fo:table-column column-width="proportional-column-width(1)" number-columns-repeated="2"/>
+            <fo:table-header>
+              <fo:table-row border="2pt solid blue">
+                <fo:table-cell border="inherit"><fo:block>Header 1.1</fo:block></fo:table-cell>
+                <fo:table-cell border="inherit"><fo:block>Header 1.2</fo:block></fo:table-cell>
+              </fo:table-row>
+            </fo:table-header>
+            <fo:table-footer>
+              <fo:table-row border="2pt solid purple">
+                <fo:table-cell border="inherit"><fo:block>Footer 1.1</fo:block></fo:table-cell>
+                <fo:table-cell border="inherit"><fo:block>Footer 1.2</fo:block></fo:table-cell>
+              </fo:table-row>
+            </fo:table-footer>
+            <fo:table-body>
+              <fo:table-row border="2pt solid green">
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 1.1</fo:block>
+                  <fo:block>Cell 1.1</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 1.2</fo:block>
+                  <fo:block>Cell 1.2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+              <fo:table-row border="2pt solid red">
+                <fo:table-cell border="inherit">
+                  <fo:block break-before="page">Cell 2.1</fo:block>
+                  <fo:block>Cell 2.1</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 2.2</fo:block>
+                  <fo:block>Cell 2.2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+              <fo:table-row border="2pt solid orange">
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 3.1</fo:block>
+                  <fo:block>Cell 3.1</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 3.2</fo:block>
+                  <fo:block>Cell 3.2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+            </fo:table-body>
+          </fo:table>
+          <fo:block>After the table</fo:block>
+        </fo:flow>
+      </fo:page-sequence>
+
+      <!-- 6. collapsing border model, discarded borders, no header/footer -->
+      <fo:page-sequence master-reference="page" font-size="8pt" line-height="10pt">
+        <fo:flow flow-name="xsl-region-body">
+          <fo:block>6. Before the table</fo:block>
+          <fo:table width="100%" table-layout="fixed"
+            border-collapse="collapse" border="2pt solid black">
+            <fo:table-column column-width="proportional-column-width(1)" number-columns-repeated="2"/>
+            <fo:table-body>
+              <fo:table-row border="2pt solid green">
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 1.1</fo:block>
+                  <fo:block>Cell 1.1</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 1.2</fo:block>
+                  <fo:block>Cell 1.2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+              <fo:table-row border="2pt solid red">
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 2.1</fo:block>
+                  <fo:block>Cell 2.1</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="inherit">
+                  <fo:block break-before="page">Cell 2.2</fo:block>
+                  <fo:block>Cell 2.2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+              <fo:table-row border="2pt solid orange">
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 3.1</fo:block>
+                  <fo:block>Cell 3.1</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 3.2</fo:block>
+                  <fo:block>Cell 3.2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+            </fo:table-body>
+          </fo:table>
+          <fo:block>After the table</fo:block>
+        </fo:flow>
+      </fo:page-sequence>
+
+      <!-- 7. collapsing border model, discarded borders, repeated header/footer -->
+      <fo:page-sequence master-reference="page" font-size="8pt" line-height="10pt">
+        <fo:flow flow-name="xsl-region-body">
+          <fo:block>7. Before the table</fo:block>
+          <fo:table width="100%" table-layout="fixed"
+            border-collapse="collapse" border="2pt solid black"
+            table-omit-header-at-break="false" table-omit-footer-at-break="false">
+            <fo:table-column column-width="proportional-column-width(1)" number-columns-repeated="2"/>
+            <fo:table-header>
+              <fo:table-row border="2pt solid blue">
+                <fo:table-cell border="inherit"><fo:block>Header 1.1</fo:block></fo:table-cell>
+                <fo:table-cell border="inherit"><fo:block>Header 1.2</fo:block></fo:table-cell>
+              </fo:table-row>
+            </fo:table-header>
+            <fo:table-footer>
+              <fo:table-row border="2pt solid purple">
+                <fo:table-cell border="inherit"><fo:block>Footer 1.1</fo:block></fo:table-cell>
+                <fo:table-cell border="inherit"><fo:block>Footer 1.2</fo:block></fo:table-cell>
+              </fo:table-row>
+            </fo:table-footer>
+            <fo:table-body>
+              <fo:table-row border="2pt solid green">
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 1.1</fo:block>
+                  <fo:block>Cell 1.1</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 1.2</fo:block>
+                  <fo:block>Cell 1.2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+              <fo:table-row border="2pt solid red">
+                <fo:table-cell border="inherit">
+                  <fo:block break-before="page">Cell 2.1</fo:block>
+                  <fo:block>Cell 2.1</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 2.2</fo:block>
+                  <fo:block>Cell 2.2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+              <fo:table-row border="2pt solid orange">
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 3.1</fo:block>
+                  <fo:block>Cell 3.1</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 3.2</fo:block>
+                  <fo:block>Cell 3.2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+            </fo:table-body>
+          </fo:table>
+          <fo:block>After the table</fo:block>
+        </fo:flow>
+      </fo:page-sequence>
+
+      <!-- 8. collapsing border model, discarded borders, omitted header/footer -->
+      <fo:page-sequence master-reference="page" font-size="8pt" line-height="10pt">
+        <fo:flow flow-name="xsl-region-body">
+          <fo:block>8. Before the table</fo:block>
+          <fo:table width="100%" table-layout="fixed"
+            border-collapse="collapse" border="2pt solid black"
+            table-omit-header-at-break="true" table-omit-footer-at-break="true">
+            <fo:table-column column-width="proportional-column-width(1)" number-columns-repeated="2"/>
+            <fo:table-header>
+              <fo:table-row border="2pt solid blue">
+                <fo:table-cell border="inherit"><fo:block>Header 1.1</fo:block></fo:table-cell>
+                <fo:table-cell border="inherit"><fo:block>Header 1.2</fo:block></fo:table-cell>
+              </fo:table-row>
+            </fo:table-header>
+            <fo:table-footer>
+              <fo:table-row border="2pt solid purple">
+                <fo:table-cell border="inherit"><fo:block>Footer 1.1</fo:block></fo:table-cell>
+                <fo:table-cell border="inherit"><fo:block>Footer 1.2</fo:block></fo:table-cell>
+              </fo:table-row>
+            </fo:table-footer>
+            <fo:table-body>
+              <fo:table-row border="2pt solid green">
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 1.1</fo:block>
+                  <fo:block>Cell 1.1</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 1.2</fo:block>
+                  <fo:block>Cell 1.2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+              <fo:table-row border="2pt solid red">
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 2.1</fo:block>
+                  <fo:block>Cell 2.1</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="inherit">
+                  <fo:block break-before="page">Cell 2.2</fo:block>
+                  <fo:block>Cell 2.2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+              <fo:table-row border="2pt solid orange">
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 3.1</fo:block>
+                  <fo:block>Cell 3.1</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 3.2</fo:block>
+                  <fo:block>Cell 3.2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+            </fo:table-body>
+          </fo:table>
+          <fo:block>After the table</fo:block>
+        </fo:flow>
+      </fo:page-sequence>
+
+    </fo:root>
+  </fo>
+  <checks>
+
+    <!-- 1. separate border model, discarded borders, no header/footer -->
+    <!-- page 1 -->
+    <eval expected="2"                    xpath="count(//pageSequence[1]/pageViewport)"/>
+    <eval expected="2"                    xpath="count(//pageViewport[@nr='1']//flow/block)"/>
+    <eval expected="1. Before the table"  xpath="//pageViewport[@nr='1']//flow/block[1]//text"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='1']//flow/block[2]/@bpd"/>
+    <eval expected="26000"                xpath="//pageViewport[@nr='1']//flow/block[2]/@bpda"/>
+    <eval expected="(solid,#000000,2000)" xpath="//pageViewport[@nr='1']//flow/block[2]/@border-before"/>
+    <eval expected=""                     xpath="//pageViewport[@nr='1']//flow/block[2]/@border-after"/>
+    <!-- cell 1.1 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='1']//flow/block[2]/block[1]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='1']//flow/block[2]/block[1]/@bpda"/>
+    <eval expected="(solid,#008000,2000)" xpath="//pageViewport[@nr='1']//flow/block[2]/block[1]/@border-before"/>
+    <eval expected="(solid,#008000,2000)" xpath="//pageViewport[@nr='1']//flow/block[2]/block[1]/@border-after"/>
+    <!-- cell 1.2 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='1']//flow/block[2]/block[2]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='1']//flow/block[2]/block[2]/@bpda"/>
+    <eval expected="(solid,#008000,2000)" xpath="//pageViewport[@nr='1']//flow/block[2]/block[2]/@border-before"/>
+    <eval expected="(solid,#008000,2000)" xpath="//pageViewport[@nr='1']//flow/block[2]/block[2]/@border-after"/>
+    <!-- page 2 -->
+    <eval expected="2"                    xpath="count(//pageViewport[@nr='2']//flow/block)"/>
+    <eval expected="After the table"      xpath="//pageViewport[@nr='2']//flow/block[2]//text"/>
+    <eval expected="48000"                xpath="//pageViewport[@nr='2']//flow/block[1]/@bpd"/>
+    <eval expected="50000"                xpath="//pageViewport[@nr='2']//flow/block[1]/@bpda"/>
+    <eval expected=""                     xpath="//pageViewport[@nr='2']//flow/block[1]/@border-before"/>
+    <eval expected="(solid,#000000,2000)" xpath="//pageViewport[@nr='2']//flow/block[1]/@border-after"/>
+    <!-- cell 2.1 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='2']//flow/block[1]/block[1]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='2']//flow/block[1]/block[1]/@bpda"/>
+    <eval expected="(solid,#ff0000,2000)" xpath="//pageViewport[@nr='2']//flow/block[1]/block[1]/@border-before"/>
+    <eval expected="(solid,#ff0000,2000)" xpath="//pageViewport[@nr='2']//flow/block[1]/block[1]/@border-after"/>
+    <!-- cell 2.2 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='2']//flow/block[1]/block[2]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='2']//flow/block[1]/block[2]/@bpda"/>
+    <eval expected="(solid,#ff0000,2000)" xpath="//pageViewport[@nr='2']//flow/block[1]/block[2]/@border-before"/>
+    <eval expected="(solid,#ff0000,2000)" xpath="//pageViewport[@nr='2']//flow/block[1]/block[2]/@border-after"/>
+    <!-- cell 3.1 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='2']//flow/block[1]/block[3]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='2']//flow/block[1]/block[3]/@bpda"/>
+    <eval expected="(solid,#ffa500,2000)" xpath="//pageViewport[@nr='2']//flow/block[1]/block[3]/@border-before"/>
+    <eval expected="(solid,#ffa500,2000)" xpath="//pageViewport[@nr='2']//flow/block[1]/block[3]/@border-after"/>
+    <!-- cell 3.2 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='2']//flow/block[1]/block[4]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='2']//flow/block[1]/block[4]/@bpda"/>
+    <eval expected="(solid,#ffa500,2000)" xpath="//pageViewport[@nr='2']//flow/block[1]/block[4]/@border-before"/>
+    <eval expected="(solid,#ffa500,2000)" xpath="//pageViewport[@nr='2']//flow/block[1]/block[4]/@border-after"/>
+
+    <!-- 2. separate border model, discarded borders, repeated header/footer -->
+    <!-- page 1 -->
+    <eval expected="2"                    xpath="count(//pageSequence[2]/pageViewport)"/>
+    <eval expected="2"                    xpath="count(//pageViewport[@nr='3']//flow/block)"/>
+    <eval expected="2. Before the table"  xpath="//pageViewport[@nr='3']//flow/block[1]//text"/>
+    <eval expected="52000"                xpath="//pageViewport[@nr='3']//flow/block[2]/@bpd"/>
+    <eval expected="54000"                xpath="//pageViewport[@nr='3']//flow/block[2]/@bpda"/>
+    <eval expected="(solid,#000000,2000)" xpath="//pageViewport[@nr='3']//flow/block[2]/@border-before"/>
+    <eval expected=""                     xpath="//pageViewport[@nr='3']//flow/block[2]/@border-after"/>
+    <!-- header 1.1 -->
+    <eval expected="10000"                xpath="//pageViewport[@nr='3']//flow/block[2]/block[1]/@bpd"/>
+    <eval expected="14000"                xpath="//pageViewport[@nr='3']//flow/block[2]/block[1]/@bpda"/>
+    <eval expected="(solid,#0000ff,2000)" xpath="//pageViewport[@nr='3']//flow/block[2]/block[1]/@border-before"/>
+    <eval expected="(solid,#0000ff,2000)" xpath="//pageViewport[@nr='3']//flow/block[2]/block[1]/@border-after"/>
+    <!-- header 1.2 -->
+    <eval expected="10000"                xpath="//pageViewport[@nr='3']//flow/block[2]/block[2]/@bpd"/>
+    <eval expected="14000"                xpath="//pageViewport[@nr='3']//flow/block[2]/block[2]/@bpda"/>
+    <eval expected="(solid,#0000ff,2000)" xpath="//pageViewport[@nr='3']//flow/block[2]/block[2]/@border-before"/>
+    <eval expected="(solid,#0000ff,2000)" xpath="//pageViewport[@nr='3']//flow/block[2]/block[2]/@border-after"/>
+    <!-- cell 1.1 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='3']//flow/block[2]/block[3]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='3']//flow/block[2]/block[3]/@bpda"/>
+    <eval expected="(solid,#008000,2000)" xpath="//pageViewport[@nr='3']//flow/block[2]/block[3]/@border-before"/>
+    <eval expected="(solid,#008000,2000)" xpath="//pageViewport[@nr='3']//flow/block[2]/block[3]/@border-after"/>
+    <!-- cell 1.2 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='3']//flow/block[2]/block[4]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='3']//flow/block[2]/block[4]/@bpda"/>
+    <eval expected="(solid,#008000,2000)" xpath="//pageViewport[@nr='3']//flow/block[2]/block[4]/@border-before"/>
+    <eval expected="(solid,#008000,2000)" xpath="//pageViewport[@nr='3']//flow/block[2]/block[4]/@border-after"/>
+    <!-- footer 1.1 -->
+    <eval expected="10000"                xpath="//pageViewport[@nr='3']//flow/block[2]/block[5]/@bpd"/>
+    <eval expected="14000"                xpath="//pageViewport[@nr='3']//flow/block[2]/block[5]/@bpda"/>
+    <eval expected="(solid,#800080,2000)" xpath="//pageViewport[@nr='3']//flow/block[2]/block[5]/@border-before"/>
+    <eval expected="(solid,#800080,2000)" xpath="//pageViewport[@nr='3']//flow/block[2]/block[5]/@border-after"/>
+    <!-- footer 1.2 -->
+    <eval expected="10000"                xpath="//pageViewport[@nr='3']//flow/block[2]/block[6]/@bpd"/>
+    <eval expected="14000"                xpath="//pageViewport[@nr='3']//flow/block[2]/block[6]/@bpda"/>
+    <eval expected="(solid,#800080,2000)" xpath="//pageViewport[@nr='3']//flow/block[2]/block[6]/@border-before"/>
+    <eval expected="(solid,#800080,2000)" xpath="//pageViewport[@nr='3']//flow/block[2]/block[6]/@border-after"/>
+    <!-- page 2 -->
+    <eval expected="2"                    xpath="count(//pageViewport[@nr='4']//flow/block)"/>
+    <eval expected="After the table"      xpath="//pageViewport[@nr='4']//flow/block[2]//text"/>
+    <eval expected="76000"                xpath="//pageViewport[@nr='4']//flow/block[1]/@bpd"/>
+    <eval expected="78000"                xpath="//pageViewport[@nr='4']//flow/block[1]/@bpda"/>
+    <eval expected=""                     xpath="//pageViewport[@nr='4']//flow/block[1]/@border-before"/>
+    <eval expected="(solid,#000000,2000)" xpath="//pageViewport[@nr='4']//flow/block[1]/@border-after"/>
+    <!-- header 1.1 -->
+    <eval expected="10000"                xpath="//pageViewport[@nr='4']//flow/block[1]/block[1]/@bpd"/>
+    <eval expected="14000"                xpath="//pageViewport[@nr='4']//flow/block[1]/block[1]/@bpda"/>
+    <eval expected="(solid,#0000ff,2000)" xpath="//pageViewport[@nr='4']//flow/block[1]/block[1]/@border-before"/>
+    <eval expected="(solid,#0000ff,2000)" xpath="//pageViewport[@nr='4']//flow/block[1]/block[1]/@border-after"/>
+    <!-- header 1.2 -->
+    <eval expected="10000"                xpath="//pageViewport[@nr='4']//flow/block[1]/block[2]/@bpd"/>
+    <eval expected="14000"                xpath="//pageViewport[@nr='4']//flow/block[1]/block[2]/@bpda"/>
+    <eval expected="(solid,#0000ff,2000)" xpath="//pageViewport[@nr='4']//flow/block[1]/block[2]/@border-before"/>
+    <eval expected="(solid,#0000ff,2000)" xpath="//pageViewport[@nr='4']//flow/block[1]/block[2]/@border-after"/>
+    <!-- cell 2.1 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='4']//flow/block[1]/block[3]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='4']//flow/block[1]/block[3]/@bpda"/>
+    <eval expected="(solid,#ff0000,2000)" xpath="//pageViewport[@nr='4']//flow/block[1]/block[3]/@border-before"/>
+    <eval expected="(solid,#ff0000,2000)" xpath="//pageViewport[@nr='4']//flow/block[1]/block[3]/@border-after"/>
+    <!-- cell 2.2 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='4']//flow/block[1]/block[4]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='4']//flow/block[1]/block[4]/@bpda"/>
+    <eval expected="(solid,#ff0000,2000)" xpath="//pageViewport[@nr='4']//flow/block[1]/block[4]/@border-before"/>
+    <eval expected="(solid,#ff0000,2000)" xpath="//pageViewport[@nr='4']//flow/block[1]/block[4]/@border-after"/>
+    <!-- cell 3.1 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='4']//flow/block[1]/block[5]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='4']//flow/block[1]/block[5]/@bpda"/>
+    <eval expected="(solid,#ffa500,2000)" xpath="//pageViewport[@nr='4']//flow/block[1]/block[5]/@border-before"/>
+    <eval expected="(solid,#ffa500,2000)" xpath="//pageViewport[@nr='4']//flow/block[1]/block[5]/@border-after"/>
+    <!-- cell 3.2 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='4']//flow/block[1]/block[6]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='4']//flow/block[1]/block[6]/@bpda"/>
+    <eval expected="(solid,#ffa500,2000)" xpath="//pageViewport[@nr='4']//flow/block[1]/block[6]/@border-before"/>
+    <eval expected="(solid,#ffa500,2000)" xpath="//pageViewport[@nr='4']//flow/block[1]/block[6]/@border-after"/>
+    <!-- footer 1.1 -->
+    <eval expected="10000"                xpath="//pageViewport[@nr='4']//flow/block[1]/block[7]/@bpd"/>
+    <eval expected="14000"                xpath="//pageViewport[@nr='4']//flow/block[1]/block[7]/@bpda"/>
+    <eval expected="(solid,#800080,2000)" xpath="//pageViewport[@nr='4']//flow/block[1]/block[7]/@border-before"/>
+    <eval expected="(solid,#800080,2000)" xpath="//pageViewport[@nr='4']//flow/block[1]/block[7]/@border-after"/>
+    <!-- footer 1.2 -->
+    <eval expected="10000"                xpath="//pageViewport[@nr='4']//flow/block[1]/block[8]/@bpd"/>
+    <eval expected="14000"                xpath="//pageViewport[@nr='4']//flow/block[1]/block[8]/@bpda"/>
+    <eval expected="(solid,#800080,2000)" xpath="//pageViewport[@nr='4']//flow/block[1]/block[8]/@border-before"/>
+    <eval expected="(solid,#800080,2000)" xpath="//pageViewport[@nr='4']//flow/block[1]/block[8]/@border-after"/>
+
+    <!-- 3. separate border model, retained borders, repeated header/footer -->
+    <!-- page 1 -->
+    <eval expected="2"                    xpath="count(//pageSequence[3]/pageViewport)"/>
+    <eval expected="2"                    xpath="count(//pageViewport[@nr='5']//flow/block)"/>
+    <eval expected="3. Before the table"  xpath="//pageViewport[@nr='5']//flow/block[1]//text"/>
+    <eval expected="52000"                xpath="//pageViewport[@nr='5']//flow/block[2]/@bpd"/>
+    <eval expected="56000"                xpath="//pageViewport[@nr='5']//flow/block[2]/@bpda"/>
+    <eval expected="(solid,#000000,2000)" xpath="//pageViewport[@nr='5']//flow/block[2]/@border-before"/>
+    <eval expected="(solid,#000000,2000)" xpath="//pageViewport[@nr='5']//flow/block[2]/@border-after"/>
+    <!-- header 1.1 -->
+    <eval expected="10000"                xpath="//pageViewport[@nr='5']//flow/block[2]/block[1]/@bpd"/>
+    <eval expected="14000"                xpath="//pageViewport[@nr='5']//flow/block[2]/block[1]/@bpda"/>
+    <eval expected="(solid,#0000ff,2000)" xpath="//pageViewport[@nr='5']//flow/block[2]/block[1]/@border-before"/>
+    <eval expected="(solid,#0000ff,2000)" xpath="//pageViewport[@nr='5']//flow/block[2]/block[1]/@border-after"/>
+    <!-- header 1.2 -->
+    <eval expected="10000"                xpath="//pageViewport[@nr='5']//flow/block[2]/block[2]/@bpd"/>
+    <eval expected="14000"                xpath="//pageViewport[@nr='5']//flow/block[2]/block[2]/@bpda"/>
+    <eval expected="(solid,#0000ff,2000)" xpath="//pageViewport[@nr='5']//flow/block[2]/block[2]/@border-before"/>
+    <eval expected="(solid,#0000ff,2000)" xpath="//pageViewport[@nr='5']//flow/block[2]/block[2]/@border-after"/>
+    <!-- cell 1.1 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='5']//flow/block[2]/block[3]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='5']//flow/block[2]/block[3]/@bpda"/>
+    <eval expected="(solid,#008000,2000)" xpath="//pageViewport[@nr='5']//flow/block[2]/block[3]/@border-before"/>
+    <eval expected="(solid,#008000,2000)" xpath="//pageViewport[@nr='5']//flow/block[2]/block[3]/@border-after"/>
+    <!-- cell 1.2 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='5']//flow/block[2]/block[4]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='5']//flow/block[2]/block[4]/@bpda"/>
+    <eval expected="(solid,#008000,2000)" xpath="//pageViewport[@nr='5']//flow/block[2]/block[4]/@border-before"/>
+    <eval expected="(solid,#008000,2000)" xpath="//pageViewport[@nr='5']//flow/block[2]/block[4]/@border-after"/>
+    <!-- footer 1.1 -->
+    <eval expected="10000"                xpath="//pageViewport[@nr='5']//flow/block[2]/block[5]/@bpd"/>
+    <eval expected="14000"                xpath="//pageViewport[@nr='5']//flow/block[2]/block[5]/@bpda"/>
+    <eval expected="(solid,#800080,2000)" xpath="//pageViewport[@nr='5']//flow/block[2]/block[5]/@border-before"/>
+    <eval expected="(solid,#800080,2000)" xpath="//pageViewport[@nr='5']//flow/block[2]/block[5]/@border-after"/>
+    <!-- footer 1.2 -->
+    <eval expected="10000"                xpath="//pageViewport[@nr='5']//flow/block[2]/block[6]/@bpd"/>
+    <eval expected="14000"                xpath="//pageViewport[@nr='5']//flow/block[2]/block[6]/@bpda"/>
+    <eval expected="(solid,#800080,2000)" xpath="//pageViewport[@nr='5']//flow/block[2]/block[6]/@border-before"/>
+    <eval expected="(solid,#800080,2000)" xpath="//pageViewport[@nr='5']//flow/block[2]/block[6]/@border-after"/>
+    <!-- page 2 -->
+    <eval expected="2"                    xpath="count(//pageViewport[@nr='6']//flow/block)"/>
+    <eval expected="After the table"      xpath="//pageViewport[@nr='6']//flow/block[2]//text"/>
+    <eval expected="76000"                xpath="//pageViewport[@nr='6']//flow/block[1]/@bpd"/>
+    <eval expected="80000"                xpath="//pageViewport[@nr='6']//flow/block[1]/@bpda"/>
+    <eval expected="(solid,#000000,2000)" xpath="//pageViewport[@nr='6']//flow/block[1]/@border-before"/>
+    <eval expected="(solid,#000000,2000)" xpath="//pageViewport[@nr='6']//flow/block[1]/@border-after"/>
+    <!-- header 1.1 -->
+    <eval expected="10000"                xpath="//pageViewport[@nr='6']//flow/block[1]/block[1]/@bpd"/>
+    <eval expected="14000"                xpath="//pageViewport[@nr='6']//flow/block[1]/block[1]/@bpda"/>
+    <eval expected="(solid,#0000ff,2000)" xpath="//pageViewport[@nr='6']//flow/block[1]/block[1]/@border-before"/>
+    <eval expected="(solid,#0000ff,2000)" xpath="//pageViewport[@nr='6']//flow/block[1]/block[1]/@border-after"/>
+    <!-- header 1.2 -->
+    <eval expected="10000"                xpath="//pageViewport[@nr='6']//flow/block[1]/block[2]/@bpd"/>
+    <eval expected="14000"                xpath="//pageViewport[@nr='6']//flow/block[1]/block[2]/@bpda"/>
+    <eval expected="(solid,#0000ff,2000)" xpath="//pageViewport[@nr='6']//flow/block[1]/block[2]/@border-before"/>
+    <eval expected="(solid,#0000ff,2000)" xpath="//pageViewport[@nr='6']//flow/block[1]/block[2]/@border-after"/>
+    <!-- cell 2.1 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='6']//flow/block[1]/block[3]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='6']//flow/block[1]/block[3]/@bpda"/>
+    <eval expected="(solid,#ff0000,2000)" xpath="//pageViewport[@nr='6']//flow/block[1]/block[3]/@border-before"/>
+    <eval expected="(solid,#ff0000,2000)" xpath="//pageViewport[@nr='6']//flow/block[1]/block[3]/@border-after"/>
+    <!-- cell 2.2 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='6']//flow/block[1]/block[4]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='6']//flow/block[1]/block[4]/@bpda"/>
+    <eval expected="(solid,#ff0000,2000)" xpath="//pageViewport[@nr='6']//flow/block[1]/block[4]/@border-before"/>
+    <eval expected="(solid,#ff0000,2000)" xpath="//pageViewport[@nr='6']//flow/block[1]/block[4]/@border-after"/>
+    <!-- cell 3.1 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='6']//flow/block[1]/block[5]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='6']//flow/block[1]/block[5]/@bpda"/>
+    <eval expected="(solid,#ffa500,2000)" xpath="//pageViewport[@nr='6']//flow/block[1]/block[5]/@border-before"/>
+    <eval expected="(solid,#ffa500,2000)" xpath="//pageViewport[@nr='6']//flow/block[1]/block[5]/@border-after"/>
+    <!-- cell 3.2 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='6']//flow/block[1]/block[6]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='6']//flow/block[1]/block[6]/@bpda"/>
+    <eval expected="(solid,#ffa500,2000)" xpath="//pageViewport[@nr='6']//flow/block[1]/block[6]/@border-before"/>
+    <eval expected="(solid,#ffa500,2000)" xpath="//pageViewport[@nr='6']//flow/block[1]/block[6]/@border-after"/>
+    <!-- footer 1.1 -->
+    <eval expected="10000"                xpath="//pageViewport[@nr='6']//flow/block[1]/block[7]/@bpd"/>
+    <eval expected="14000"                xpath="//pageViewport[@nr='6']//flow/block[1]/block[7]/@bpda"/>
+    <eval expected="(solid,#800080,2000)" xpath="//pageViewport[@nr='6']//flow/block[1]/block[7]/@border-before"/>
+    <eval expected="(solid,#800080,2000)" xpath="//pageViewport[@nr='6']//flow/block[1]/block[7]/@border-after"/>
+    <!-- footer 1.2 -->
+    <eval expected="10000"                xpath="//pageViewport[@nr='6']//flow/block[1]/block[8]/@bpd"/>
+    <eval expected="14000"                xpath="//pageViewport[@nr='6']//flow/block[1]/block[8]/@bpda"/>
+    <eval expected="(solid,#800080,2000)" xpath="//pageViewport[@nr='6']//flow/block[1]/block[8]/@border-before"/>
+    <eval expected="(solid,#800080,2000)" xpath="//pageViewport[@nr='6']//flow/block[1]/block[8]/@border-after"/>
+
+    <!-- 4. separate border model, discarded borders, omitted header/footer -->
+    <!-- page 1 -->
+    <eval expected="2"                    xpath="count(//pageSequence[4]/pageViewport)"/>
+    <eval expected="2"                    xpath="count(//pageViewport[@nr='7']//flow/block)"/>
+    <eval expected="4. Before the table"  xpath="//pageViewport[@nr='7']//flow/block[1]//text"/>
+    <eval expected="38000"                xpath="//pageViewport[@nr='7']//flow/block[2]/@bpd"/>
+    <eval expected="40000"                xpath="//pageViewport[@nr='7']//flow/block[2]/@bpda"/>
+    <eval expected="(solid,#000000,2000)" xpath="//pageViewport[@nr='7']//flow/block[2]/@border-before"/>
+    <eval expected=""                     xpath="//pageViewport[@nr='7']//flow/block[2]/@border-after"/>
+    <!-- header 1.1 -->
+    <eval expected="10000"                xpath="//pageViewport[@nr='7']//flow/block[2]/block[1]/@bpd"/>
+    <eval expected="14000"                xpath="//pageViewport[@nr='7']//flow/block[2]/block[1]/@bpda"/>
+    <eval expected="(solid,#0000ff,2000)" xpath="//pageViewport[@nr='7']//flow/block[2]/block[1]/@border-before"/>
+    <eval expected="(solid,#0000ff,2000)" xpath="//pageViewport[@nr='7']//flow/block[2]/block[1]/@border-after"/>
+    <!-- header 1.2 -->
+    <eval expected="10000"                xpath="//pageViewport[@nr='7']//flow/block[2]/block[2]/@bpd"/>
+    <eval expected="14000"                xpath="//pageViewport[@nr='7']//flow/block[2]/block[2]/@bpda"/>
+    <eval expected="(solid,#0000ff,2000)" xpath="//pageViewport[@nr='7']//flow/block[2]/block[2]/@border-before"/>
+    <eval expected="(solid,#0000ff,2000)" xpath="//pageViewport[@nr='7']//flow/block[2]/block[2]/@border-after"/>
+    <!-- cell 1.1 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='7']//flow/block[2]/block[3]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='7']//flow/block[2]/block[3]/@bpda"/>
+    <eval expected="(solid,#008000,2000)" xpath="//pageViewport[@nr='7']//flow/block[2]/block[3]/@border-before"/>
+    <eval expected="(solid,#008000,2000)" xpath="//pageViewport[@nr='7']//flow/block[2]/block[3]/@border-after"/>
+    <!-- cell 1.2 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='7']//flow/block[2]/block[4]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='7']//flow/block[2]/block[4]/@bpda"/>
+    <eval expected="(solid,#008000,2000)" xpath="//pageViewport[@nr='7']//flow/block[2]/block[4]/@border-before"/>
+    <eval expected="(solid,#008000,2000)" xpath="//pageViewport[@nr='7']//flow/block[2]/block[4]/@border-after"/>
+    <!-- page 2 -->
+    <eval expected="2"                    xpath="count(//pageViewport[@nr='8']//flow/block)"/>
+    <eval expected="After the table"      xpath="//pageViewport[@nr='8']//flow/block[2]//text"/>
+    <eval expected="62000"                xpath="//pageViewport[@nr='8']//flow/block[1]/@bpd"/>
+    <eval expected="64000"                xpath="//pageViewport[@nr='8']//flow/block[1]/@bpda"/>
+    <eval expected=""                     xpath="//pageViewport[@nr='8']//flow/block[1]/@border-before"/>
+    <eval expected="(solid,#000000,2000)" xpath="//pageViewport[@nr='8']//flow/block[1]/@border-after"/>
+    <!-- cell 2.1 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='8']//flow/block[1]/block[1]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='8']//flow/block[1]/block[1]/@bpda"/>
+    <eval expected="(solid,#ff0000,2000)" xpath="//pageViewport[@nr='8']//flow/block[1]/block[1]/@border-before"/>
+    <eval expected="(solid,#ff0000,2000)" xpath="//pageViewport[@nr='8']//flow/block[1]/block[1]/@border-after"/>
+    <!-- cell 2.2 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='8']//flow/block[1]/block[2]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='8']//flow/block[1]/block[2]/@bpda"/>
+    <eval expected="(solid,#ff0000,2000)" xpath="//pageViewport[@nr='8']//flow/block[1]/block[2]/@border-before"/>
+    <eval expected="(solid,#ff0000,2000)" xpath="//pageViewport[@nr='8']//flow/block[1]/block[2]/@border-after"/>
+    <!-- cell 3.1 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='8']//flow/block[1]/block[3]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='8']//flow/block[1]/block[3]/@bpda"/>
+    <eval expected="(solid,#ffa500,2000)" xpath="//pageViewport[@nr='8']//flow/block[1]/block[3]/@border-before"/>
+    <eval expected="(solid,#ffa500,2000)" xpath="//pageViewport[@nr='8']//flow/block[1]/block[3]/@border-after"/>
+    <!-- cell 3.2 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='8']//flow/block[1]/block[4]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='8']//flow/block[1]/block[4]/@bpda"/>
+    <eval expected="(solid,#ffa500,2000)" xpath="//pageViewport[@nr='8']//flow/block[1]/block[4]/@border-before"/>
+    <eval expected="(solid,#ffa500,2000)" xpath="//pageViewport[@nr='8']//flow/block[1]/block[4]/@border-after"/>
+    <!-- footer 1.1 -->
+    <eval expected="10000"                xpath="//pageViewport[@nr='8']//flow/block[1]/block[5]/@bpd"/>
+    <eval expected="14000"                xpath="//pageViewport[@nr='8']//flow/block[1]/block[5]/@bpda"/>
+    <eval expected="(solid,#800080,2000)" xpath="//pageViewport[@nr='8']//flow/block[1]/block[5]/@border-before"/>
+    <eval expected="(solid,#800080,2000)" xpath="//pageViewport[@nr='8']//flow/block[1]/block[5]/@border-after"/>
+    <!-- footer 1.2 -->
+    <eval expected="10000"                xpath="//pageViewport[@nr='8']//flow/block[1]/block[6]/@bpd"/>
+    <eval expected="14000"                xpath="//pageViewport[@nr='8']//flow/block[1]/block[6]/@bpda"/>
+    <eval expected="(solid,#800080,2000)" xpath="//pageViewport[@nr='8']//flow/block[1]/block[6]/@border-before"/>
+    <eval expected="(solid,#800080,2000)" xpath="//pageViewport[@nr='8']//flow/block[1]/block[6]/@border-after"/>
+
+    <!-- 5. separate border model, retained borders, omitted header/footer -->
+    <!-- page 1 -->
+    <eval expected="2"                    xpath="count(//pageSequence[5]/pageViewport)"/>
+    <eval expected="2"                    xpath="count(//pageViewport[@nr='9']//flow/block)"/>
+    <eval expected="5. Before the table"  xpath="//pageViewport[@nr='9']//flow/block[1]//text"/>
+    <eval expected="38000"                xpath="//pageViewport[@nr='9']//flow/block[2]/@bpd"/>
+    <eval expected="42000"                xpath="//pageViewport[@nr='9']//flow/block[2]/@bpda"/>
+    <eval expected="(solid,#000000,2000)" xpath="//pageViewport[@nr='9']//flow/block[2]/@border-before"/>
+    <eval expected="(solid,#000000,2000)" xpath="//pageViewport[@nr='9']//flow/block[2]/@border-after"/>
+    <!-- header 1.1 -->
+    <eval expected="10000"                xpath="//pageViewport[@nr='9']//flow/block[2]/block[1]/@bpd"/>
+    <eval expected="14000"                xpath="//pageViewport[@nr='9']//flow/block[2]/block[1]/@bpda"/>
+    <eval expected="(solid,#0000ff,2000)" xpath="//pageViewport[@nr='9']//flow/block[2]/block[1]/@border-before"/>
+    <eval expected="(solid,#0000ff,2000)" xpath="//pageViewport[@nr='9']//flow/block[2]/block[1]/@border-after"/>
+    <!-- header 1.2 -->
+    <eval expected="10000"                xpath="//pageViewport[@nr='9']//flow/block[2]/block[2]/@bpd"/>
+    <eval expected="14000"                xpath="//pageViewport[@nr='9']//flow/block[2]/block[2]/@bpda"/>
+    <eval expected="(solid,#0000ff,2000)" xpath="//pageViewport[@nr='9']//flow/block[2]/block[2]/@border-before"/>
+    <eval expected="(solid,#0000ff,2000)" xpath="//pageViewport[@nr='9']//flow/block[2]/block[2]/@border-after"/>
+    <!-- cell 1.1 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='9']//flow/block[2]/block[3]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='9']//flow/block[2]/block[3]/@bpda"/>
+    <eval expected="(solid,#008000,2000)" xpath="//pageViewport[@nr='9']//flow/block[2]/block[3]/@border-before"/>
+    <eval expected="(solid,#008000,2000)" xpath="//pageViewport[@nr='9']//flow/block[2]/block[3]/@border-after"/>
+    <!-- cell 1.2 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='9']//flow/block[2]/block[4]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='9']//flow/block[2]/block[4]/@bpda"/>
+    <eval expected="(solid,#008000,2000)" xpath="//pageViewport[@nr='9']//flow/block[2]/block[4]/@border-before"/>
+    <eval expected="(solid,#008000,2000)" xpath="//pageViewport[@nr='9']//flow/block[2]/block[4]/@border-after"/>
+    <!-- page 2 -->
+    <eval expected="2"                    xpath="count(//pageViewport[@nr='10']//flow/block)"/>
+    <eval expected="After the table"      xpath="//pageViewport[@nr='10']//flow/block[2]//text"/>
+    <eval expected="62000"                xpath="//pageViewport[@nr='10']//flow/block[1]/@bpd"/>
+    <eval expected="66000"                xpath="//pageViewport[@nr='10']//flow/block[1]/@bpda"/>
+    <eval expected="(solid,#000000,2000)" xpath="//pageViewport[@nr='10']//flow/block[1]/@border-before"/>
+    <eval expected="(solid,#000000,2000)" xpath="//pageViewport[@nr='10']//flow/block[1]/@border-after"/>
+    <!-- cell 2.1 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='10']//flow/block[1]/block[1]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='10']//flow/block[1]/block[1]/@bpda"/>
+    <eval expected="(solid,#ff0000,2000)" xpath="//pageViewport[@nr='10']//flow/block[1]/block[1]/@border-before"/>
+    <eval expected="(solid,#ff0000,2000)" xpath="//pageViewport[@nr='10']//flow/block[1]/block[1]/@border-after"/>
+    <!-- cell 2.2 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='10']//flow/block[1]/block[2]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='10']//flow/block[1]/block[2]/@bpda"/>
+    <eval expected="(solid,#ff0000,2000)" xpath="//pageViewport[@nr='10']//flow/block[1]/block[2]/@border-before"/>
+    <eval expected="(solid,#ff0000,2000)" xpath="//pageViewport[@nr='10']//flow/block[1]/block[2]/@border-after"/>
+    <!-- cell 3.1 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='10']//flow/block[1]/block[3]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='10']//flow/block[1]/block[3]/@bpda"/>
+    <eval expected="(solid,#ffa500,2000)" xpath="//pageViewport[@nr='10']//flow/block[1]/block[3]/@border-before"/>
+    <eval expected="(solid,#ffa500,2000)" xpath="//pageViewport[@nr='10']//flow/block[1]/block[3]/@border-after"/>
+    <!-- cell 3.2 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='10']//flow/block[1]/block[4]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='10']//flow/block[1]/block[4]/@bpda"/>
+    <eval expected="(solid,#ffa500,2000)" xpath="//pageViewport[@nr='10']//flow/block[1]/block[4]/@border-before"/>
+    <eval expected="(solid,#ffa500,2000)" xpath="//pageViewport[@nr='10']//flow/block[1]/block[4]/@border-after"/>
+    <!-- footer 1.1 -->
+    <eval expected="10000"                xpath="//pageViewport[@nr='10']//flow/block[1]/block[5]/@bpd"/>
+    <eval expected="14000"                xpath="//pageViewport[@nr='10']//flow/block[1]/block[5]/@bpda"/>
+    <eval expected="(solid,#800080,2000)" xpath="//pageViewport[@nr='10']//flow/block[1]/block[5]/@border-before"/>
+    <eval expected="(solid,#800080,2000)" xpath="//pageViewport[@nr='10']//flow/block[1]/block[5]/@border-after"/>
+    <!-- footer 1.2 -->
+    <eval expected="10000"                xpath="//pageViewport[@nr='10']//flow/block[1]/block[6]/@bpd"/>
+    <eval expected="14000"                xpath="//pageViewport[@nr='10']//flow/block[1]/block[6]/@bpda"/>
+    <eval expected="(solid,#800080,2000)" xpath="//pageViewport[@nr='10']//flow/block[1]/block[6]/@border-before"/>
+    <eval expected="(solid,#800080,2000)" xpath="//pageViewport[@nr='10']//flow/block[1]/block[6]/@border-after"/>
+
+    <!-- 6. collapsing border model, discarded borders, no header/footer -->
+    <!-- page 1 -->
+    <eval expected="2"                                   xpath="count(//pageSequence[6]/pageViewport)"/>
+    <eval expected="2"                                   xpath="count(//pageViewport[@nr='11']//flow/block)"/>
+    <eval expected="6. Before the table"                 xpath="//pageViewport[@nr='11']//flow/block[1]//text"/>
+    <eval expected="22000"                               xpath="//pageViewport[@nr='11']//flow/block[2]/@bpd"/>
+    <eval expected="22000"                               xpath="//pageViewport[@nr='11']//flow/block[2]/@bpda"/>
+    <!-- cell 1.1 -->
+    <eval expected="20000"                               xpath="//pageViewport[@nr='11']//flow/block[2]/block[1]/@bpd"/>
+    <eval expected="24000"                               xpath="//pageViewport[@nr='11']//flow/block[2]/block[1]/@bpda"/>
+    <eval expected="(solid,#008000,2000,collapse-outer)" xpath="//pageViewport[@nr='11']//flow/block[2]/block[1]/@border-before"/>
+    <eval expected="(solid,#008000,2000,collapse-outer)" xpath="//pageViewport[@nr='11']//flow/block[2]/block[1]/@border-after"/>
+    <!-- cell 1.2 -->
+    <eval expected="20000"                               xpath="//pageViewport[@nr='11']//flow/block[2]/block[2]/@bpd"/>
+    <eval expected="24000"                               xpath="//pageViewport[@nr='11']//flow/block[2]/block[2]/@bpda"/>
+    <eval expected="(solid,#008000,2000,collapse-outer)" xpath="//pageViewport[@nr='11']//flow/block[2]/block[2]/@border-before"/>
+    <eval expected="(solid,#008000,2000,collapse-outer)" xpath="//pageViewport[@nr='11']//flow/block[2]/block[2]/@border-after"/>
+    <!-- page 2 -->
+    <eval expected="2"                                   xpath="count(//pageViewport[@nr='12']//flow/block)"/>
+    <eval expected="After the table"                     xpath="//pageViewport[@nr='12']//flow/block[2]//text"/>
+    <eval expected="44000"                               xpath="//pageViewport[@nr='12']//flow/block[1]/@bpd"/>
+    <eval expected="44000"                               xpath="//pageViewport[@nr='12']//flow/block[1]/@bpda"/>
+    <!-- cell 2.1 -->
+    <eval expected="20000"                               xpath="//pageViewport[@nr='12']//flow/block[1]/block[1]/@bpd"/>
+    <eval expected="24000"                               xpath="//pageViewport[@nr='12']//flow/block[1]/block[1]/@bpda"/>
+    <eval expected="(solid,#ff0000,2000,collapse-outer)" xpath="//pageViewport[@nr='12']//flow/block[1]/block[1]/@border-before"/>
+    <eval expected="(solid,#ff0000,2000,collapse-inner)" xpath="//pageViewport[@nr='12']//flow/block[1]/block[1]/@border-after"/>
+    <!-- cell 2.2 -->
+    <eval expected="20000"                               xpath="//pageViewport[@nr='12']//flow/block[1]/block[2]/@bpd"/>
+    <eval expected="24000"                               xpath="//pageViewport[@nr='12']//flow/block[1]/block[2]/@bpda"/>
+    <eval expected="(solid,#ff0000,2000,collapse-outer)" xpath="//pageViewport[@nr='12']//flow/block[1]/block[2]/@border-before"/>
+    <eval expected="(solid,#ff0000,2000,collapse-inner)" xpath="//pageViewport[@nr='12']//flow/block[1]/block[2]/@border-after"/>
+    <!-- cell 3.1 -->
+    <eval expected="20000"                               xpath="//pageViewport[@nr='12']//flow/block[1]/block[3]/@bpd"/>
+    <eval expected="24000"                               xpath="//pageViewport[@nr='12']//flow/block[1]/block[3]/@bpda"/>
+    <eval expected="(solid,#ffa500,2000,collapse-inner)" xpath="//pageViewport[@nr='12']//flow/block[1]/block[3]/@border-before"/>
+    <eval expected="(solid,#ffa500,2000,collapse-outer)" xpath="//pageViewport[@nr='12']//flow/block[1]/block[3]/@border-after"/>
+    <!-- cell 3.2 -->
+    <eval expected="20000"                               xpath="//pageViewport[@nr='12']//flow/block[1]/block[4]/@bpd"/>
+    <eval expected="24000"                               xpath="//pageViewport[@nr='12']//flow/block[1]/block[4]/@bpda"/>
+    <eval expected="(solid,#ffa500,2000,collapse-inner)" xpath="//pageViewport[@nr='12']//flow/block[1]/block[4]/@border-before"/>
+    <eval expected="(solid,#ffa500,2000,collapse-outer)" xpath="//pageViewport[@nr='12']//flow/block[1]/block[4]/@border-after"/>
+
+    <!-- 7. collapsing border model, discarded borders, repeated header/footer -->
+    <!-- page 1 -->
+    <eval expected="2"                                   xpath="count(//pageSequence[7]/pageViewport)"/>
+    <eval expected="2"                                   xpath="count(//pageViewport[@nr='13']//flow/block)"/>
+    <eval expected="7. Before the table"                 xpath="//pageViewport[@nr='13']//flow/block[1]//text"/>
+    <eval expected="46000"                               xpath="//pageViewport[@nr='13']//flow/block[2]/@bpd"/>
+    <eval expected="46000"                               xpath="//pageViewport[@nr='13']//flow/block[2]/@bpda"/>
+    <!-- header 1.1 -->
+    <eval expected="10000"                               xpath="//pageViewport[@nr='13']//flow/block[2]/block[1]/@bpd"/>
+    <eval expected="14000"                               xpath="//pageViewport[@nr='13']//flow/block[2]/block[1]/@bpda"/>
+    <eval expected="(solid,#0000ff,2000,collapse-outer)" xpath="//pageViewport[@nr='13']//flow/block[2]/block[1]/@border-before"/>
+    <eval expected="(solid,#0000ff,2000,collapse-inner)" xpath="//pageViewport[@nr='13']//flow/block[2]/block[1]/@border-after"/>
+    <!-- header 1.2 -->
+    <eval expected="10000"                               xpath="//pageViewport[@nr='13']//flow/block[2]/block[2]/@bpd"/>
+    <eval expected="14000"                               xpath="//pageViewport[@nr='13']//flow/block[2]/block[2]/@bpda"/>
+    <eval expected="(solid,#0000ff,2000,collapse-outer)" xpath="//pageViewport[@nr='13']//flow/block[2]/block[2]/@border-before"/>
+    <eval expected="(solid,#0000ff,2000,collapse-inner)" xpath="//pageViewport[@nr='13']//flow/block[2]/block[2]/@border-after"/>
+    <!-- cell 1.1 -->
+    <eval expected="20000"                               xpath="//pageViewport[@nr='13']//flow/block[2]/block[3]/@bpd"/>
+    <eval expected="24000"                               xpath="//pageViewport[@nr='13']//flow/block[2]/block[3]/@bpda"/>
+    <eval expected="(solid,#008000,2000,collapse-inner)" xpath="//pageViewport[@nr='13']//flow/block[2]/block[3]/@border-before"/>
+    <eval expected="(solid,#008000,2000,collapse-inner)" xpath="//pageViewport[@nr='13']//flow/block[2]/block[3]/@border-after"/>
+    <!-- cell 1.2 -->
+    <eval expected="20000"                               xpath="//pageViewport[@nr='13']//flow/block[2]/block[4]/@bpd"/>
+    <eval expected="24000"                               xpath="//pageViewport[@nr='13']//flow/block[2]/block[4]/@bpda"/>
+    <eval expected="(solid,#008000,2000,collapse-inner)" xpath="//pageViewport[@nr='13']//flow/block[2]/block[4]/@border-before"/>
+    <eval expected="(solid,#008000,2000,collapse-inner)" xpath="//pageViewport[@nr='13']//flow/block[2]/block[4]/@border-after"/>
+    <!-- footer 1.1 -->
+    <eval expected="10000"                               xpath="//pageViewport[@nr='13']//flow/block[2]/block[5]/@bpd"/>
+    <eval expected="14000"                               xpath="//pageViewport[@nr='13']//flow/block[2]/block[5]/@bpda"/>
+    <eval expected="(solid,#800080,2000,collapse-inner)" xpath="//pageViewport[@nr='13']//flow/block[2]/block[5]/@border-before"/>
+    <eval expected="(solid,#800080,2000,collapse-outer)" xpath="//pageViewport[@nr='13']//flow/block[2]/block[5]/@border-after"/>
+    <!-- footer 1.2 -->
+    <eval expected="10000"                               xpath="//pageViewport[@nr='13']//flow/block[2]/block[6]/@bpd"/>
+    <eval expected="14000"                               xpath="//pageViewport[@nr='13']//flow/block[2]/block[6]/@bpda"/>
+    <eval expected="(solid,#800080,2000,collapse-inner)" xpath="//pageViewport[@nr='13']//flow/block[2]/block[6]/@border-before"/>
+    <eval expected="(solid,#800080,2000,collapse-outer)" xpath="//pageViewport[@nr='13']//flow/block[2]/block[6]/@border-after"/>
+    <!-- page 2 -->
+    <eval expected="2"                                   xpath="count(//pageViewport[@nr='14']//flow/block)"/>
+    <eval expected="After the table"                     xpath="//pageViewport[@nr='14']//flow/block[2]//text"/>
+    <eval expected="68000"                               xpath="//pageViewport[@nr='14']//flow/block[1]/@bpd"/>
+    <eval expected="68000"                               xpath="//pageViewport[@nr='14']//flow/block[1]/@bpda"/>
+    <!-- header 1.1 -->
+    <eval expected="10000"                               xpath="//pageViewport[@nr='14']//flow/block[1]/block[1]/@bpd"/>
+    <eval expected="14000"                               xpath="//pageViewport[@nr='14']//flow/block[1]/block[1]/@bpda"/>
+    <eval expected="(solid,#0000ff,2000,collapse-outer)" xpath="//pageViewport[@nr='14']//flow/block[1]/block[1]/@border-before"/>
+    <eval expected="(solid,#0000ff,2000,collapse-inner)" xpath="//pageViewport[@nr='14']//flow/block[1]/block[1]/@border-after"/>
+    <!-- header 1.2 -->
+    <eval expected="10000"                               xpath="//pageViewport[@nr='14']//flow/block[1]/block[2]/@bpd"/>
+    <eval expected="14000"                               xpath="//pageViewport[@nr='14']//flow/block[1]/block[2]/@bpda"/>
+    <eval expected="(solid,#0000ff,2000,collapse-outer)" xpath="//pageViewport[@nr='14']//flow/block[1]/block[2]/@border-before"/>
+    <eval expected="(solid,#0000ff,2000,collapse-inner)" xpath="//pageViewport[@nr='14']//flow/block[1]/block[2]/@border-after"/>
+    <!-- cell 2.1 -->
+    <eval expected="20000"                               xpath="//pageViewport[@nr='14']//flow/block[1]/block[3]/@bpd"/>
+    <eval expected="24000"                               xpath="//pageViewport[@nr='14']//flow/block[1]/block[3]/@bpda"/>
+    <eval expected="(solid,#ff0000,2000,collapse-inner)" xpath="//pageViewport[@nr='14']//flow/block[1]/block[3]/@border-before"/>
+    <eval expected="(solid,#ff0000,2000,collapse-inner)" xpath="//pageViewport[@nr='14']//flow/block[1]/block[3]/@border-after"/>
+    <!-- cell 2.2 -->
+    <eval expected="20000"                               xpath="//pageViewport[@nr='14']//flow/block[1]/block[4]/@bpd"/>
+    <eval expected="24000"                               xpath="//pageViewport[@nr='14']//flow/block[1]/block[4]/@bpda"/>
+    <eval expected="(solid,#ff0000,2000,collapse-inner)" xpath="//pageViewport[@nr='14']//flow/block[1]/block[4]/@border-before"/>
+    <eval expected="(solid,#ff0000,2000,collapse-inner)" xpath="//pageViewport[@nr='14']//flow/block[1]/block[4]/@border-after"/>
+    <!-- cell 3.1 -->
+    <eval expected="20000"                               xpath="//pageViewport[@nr='14']//flow/block[1]/block[5]/@bpd"/>
+    <eval expected="24000"                               xpath="//pageViewport[@nr='14']//flow/block[1]/block[5]/@bpda"/>
+    <eval expected="(solid,#ffa500,2000,collapse-inner)" xpath="//pageViewport[@nr='14']//flow/block[1]/block[5]/@border-before"/>
+    <eval expected="(solid,#ffa500,2000,collapse-inner)" xpath="//pageViewport[@nr='14']//flow/block[1]/block[5]/@border-after"/>
+    <!-- cell 3.2 -->
+    <eval expected="20000"                               xpath="//pageViewport[@nr='14']//flow/block[1]/block[6]/@bpd"/>
+    <eval expected="24000"                               xpath="//pageViewport[@nr='14']//flow/block[1]/block[6]/@bpda"/>
+    <eval expected="(solid,#ffa500,2000,collapse-inner)" xpath="//pageViewport[@nr='14']//flow/block[1]/block[6]/@border-before"/>
+    <eval expected="(solid,#ffa500,2000,collapse-inner)" xpath="//pageViewport[@nr='14']//flow/block[1]/block[6]/@border-after"/>
+    <!-- footer 1.1 -->
+    <eval expected="10000"                               xpath="//pageViewport[@nr='14']//flow/block[1]/block[7]/@bpd"/>
+    <eval expected="14000"                               xpath="//pageViewport[@nr='14']//flow/block[1]/block[7]/@bpda"/>
+    <eval expected="(solid,#800080,2000,collapse-inner)" xpath="//pageViewport[@nr='14']//flow/block[1]/block[7]/@border-before"/>
+    <eval expected="(solid,#800080,2000,collapse-outer)" xpath="//pageViewport[@nr='14']//flow/block[1]/block[7]/@border-after"/>
+    <!-- footer 1.2 -->
+    <eval expected="10000"                               xpath="//pageViewport[@nr='14']//flow/block[1]/block[8]/@bpd"/>
+    <eval expected="14000"                               xpath="//pageViewport[@nr='14']//flow/block[1]/block[8]/@bpda"/>
+    <eval expected="(solid,#800080,2000,collapse-inner)" xpath="//pageViewport[@nr='14']//flow/block[1]/block[8]/@border-before"/>
+    <eval expected="(solid,#800080,2000,collapse-outer)" xpath="//pageViewport[@nr='14']//flow/block[1]/block[8]/@border-after"/>
+
+    <!-- 8. collapsing border model, discarded borders, omitted header/footer -->
+    <!-- page 1 -->
+    <eval expected="2"                                   xpath="count(//pageSequence[8]/pageViewport)"/>
+    <eval expected="2"                                   xpath="count(//pageViewport[@nr='15']//flow/block)"/>
+    <eval expected="8. Before the table"                 xpath="//pageViewport[@nr='15']//flow/block[1]//text"/>
+    <eval expected="34000"                               xpath="//pageViewport[@nr='15']//flow/block[2]/@bpd"/>
+    <eval expected="34000"                               xpath="//pageViewport[@nr='15']//flow/block[2]/@bpda"/>
+    <!-- header 1.1 -->
+    <eval expected="10000"                               xpath="//pageViewport[@nr='15']//flow/block[2]/block[1]/@bpd"/>
+    <eval expected="14000"                               xpath="//pageViewport[@nr='15']//flow/block[2]/block[1]/@bpda"/>
+    <eval expected="(solid,#0000ff,2000,collapse-outer)" xpath="//pageViewport[@nr='15']//flow/block[2]/block[1]/@border-before"/>
+    <eval expected="(solid,#0000ff,2000,collapse-inner)" xpath="//pageViewport[@nr='15']//flow/block[2]/block[1]/@border-after"/>
+    <!-- header 1.2 -->
+    <eval expected="10000"                               xpath="//pageViewport[@nr='15']//flow/block[2]/block[2]/@bpd"/>
+    <eval expected="14000"                               xpath="//pageViewport[@nr='15']//flow/block[2]/block[2]/@bpda"/>
+    <eval expected="(solid,#0000ff,2000,collapse-outer)" xpath="//pageViewport[@nr='15']//flow/block[2]/block[2]/@border-before"/>
+    <eval expected="(solid,#0000ff,2000,collapse-inner)" xpath="//pageViewport[@nr='15']//flow/block[2]/block[2]/@border-after"/>
+    <!-- cell 1.1 -->
+    <eval expected="20000"                               xpath="//pageViewport[@nr='15']//flow/block[2]/block[3]/@bpd"/>
+    <eval expected="24000"                               xpath="//pageViewport[@nr='15']//flow/block[2]/block[3]/@bpda"/>
+    <eval expected="(solid,#008000,2000,collapse-inner)" xpath="//pageViewport[@nr='15']//flow/block[2]/block[3]/@border-before"/>
+    <eval expected="(solid,#008000,2000,collapse-outer)" xpath="//pageViewport[@nr='15']//flow/block[2]/block[3]/@border-after"/>
+    <!-- cell 1.2 -->
+    <eval expected="20000"                               xpath="//pageViewport[@nr='15']//flow/block[2]/block[4]/@bpd"/>
+    <eval expected="24000"                               xpath="//pageViewport[@nr='15']//flow/block[2]/block[4]/@bpda"/>
+    <eval expected="(solid,#008000,2000,collapse-inner)" xpath="//pageViewport[@nr='15']//flow/block[2]/block[4]/@border-before"/>
+    <eval expected="(solid,#008000,2000,collapse-outer)" xpath="//pageViewport[@nr='15']//flow/block[2]/block[4]/@border-after"/>
+    <!-- page 2 -->
+    <eval expected="2"                                   xpath="count(//pageViewport[@nr='16']//flow/block)"/>
+    <eval expected="After the table"                     xpath="//pageViewport[@nr='16']//flow/block[2]//text"/>
+    <eval expected="56000"                               xpath="//pageViewport[@nr='16']//flow/block[1]/@bpd"/>
+    <eval expected="56000"                               xpath="//pageViewport[@nr='16']//flow/block[1]/@bpda"/>
+    <!-- cell 2.1 -->
+    <eval expected="20000"                               xpath="//pageViewport[@nr='16']//flow/block[1]/block[1]/@bpd"/>
+    <eval expected="24000"                               xpath="//pageViewport[@nr='16']//flow/block[1]/block[1]/@bpda"/>
+    <eval expected="(solid,#ff0000,2000,collapse-outer)" xpath="//pageViewport[@nr='16']//flow/block[1]/block[1]/@border-before"/>
+    <eval expected="(solid,#ff0000,2000,collapse-inner)" xpath="//pageViewport[@nr='16']//flow/block[1]/block[1]/@border-after"/>
+    <!-- cell 2.2 -->
+    <eval expected="20000"                               xpath="//pageViewport[@nr='16']//flow/block[1]/block[2]/@bpd"/>
+    <eval expected="24000"                               xpath="//pageViewport[@nr='16']//flow/block[1]/block[2]/@bpda"/>
+    <eval expected="(solid,#ff0000,2000,collapse-outer)" xpath="//pageViewport[@nr='16']//flow/block[1]/block[2]/@border-before"/>
+    <eval expected="(solid,#ff0000,2000,collapse-inner)" xpath="//pageViewport[@nr='16']//flow/block[1]/block[2]/@border-after"/>
+    <!-- cell 3.1 -->
+    <eval expected="20000"                               xpath="//pageViewport[@nr='16']//flow/block[1]/block[3]/@bpd"/>
+    <eval expected="24000"                               xpath="//pageViewport[@nr='16']//flow/block[1]/block[3]/@bpda"/>
+    <eval expected="(solid,#ffa500,2000,collapse-inner)" xpath="//pageViewport[@nr='16']//flow/block[1]/block[3]/@border-before"/>
+    <eval expected="(solid,#ffa500,2000,collapse-inner)" xpath="//pageViewport[@nr='16']//flow/block[1]/block[3]/@border-after"/>
+    <!-- cell 3.2 -->
+    <eval expected="20000"                               xpath="//pageViewport[@nr='16']//flow/block[1]/block[4]/@bpd"/>
+    <eval expected="24000"                               xpath="//pageViewport[@nr='16']//flow/block[1]/block[4]/@bpda"/>
+    <eval expected="(solid,#ffa500,2000,collapse-inner)" xpath="//pageViewport[@nr='16']//flow/block[1]/block[4]/@border-before"/>
+    <eval expected="(solid,#ffa500,2000,collapse-inner)" xpath="//pageViewport[@nr='16']//flow/block[1]/block[4]/@border-after"/>
+    <!-- footer 1.1 -->
+    <eval expected="10000"                               xpath="//pageViewport[@nr='16']//flow/block[1]/block[5]/@bpd"/>
+    <eval expected="14000"                               xpath="//pageViewport[@nr='16']//flow/block[1]/block[5]/@bpda"/>
+    <eval expected="(solid,#800080,2000,collapse-inner)" xpath="//pageViewport[@nr='16']//flow/block[1]/block[5]/@border-before"/>
+    <eval expected="(solid,#800080,2000,collapse-outer)" xpath="//pageViewport[@nr='16']//flow/block[1]/block[5]/@border-after"/>
+    <!-- footer 1.2 -->
+    <eval expected="10000"                               xpath="//pageViewport[@nr='16']//flow/block[1]/block[6]/@bpd"/>
+    <eval expected="14000"                               xpath="//pageViewport[@nr='16']//flow/block[1]/block[6]/@bpda"/>
+    <eval expected="(solid,#800080,2000,collapse-inner)" xpath="//pageViewport[@nr='16']//flow/block[1]/block[6]/@border-before"/>
+    <eval expected="(solid,#800080,2000,collapse-outer)" xpath="//pageViewport[@nr='16']//flow/block[1]/block[6]/@border-after"/>
+
+  </checks>
+</testcase>
diff --git a/test/layoutengine/standard-testcases/table-cell_break-before_first-row.xml b/test/layoutengine/standard-testcases/table-cell_break-before_first-row.xml
new file mode 100644 (file)
index 0000000..c5e704a
--- /dev/null
@@ -0,0 +1,688 @@
+<?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 that break-before set on blocks in table-cells works correctly in various
+      conditions: when headers/footers shall be repeated at page breaks or not, in the separate or
+      collapsing border model, etc.
+    </p>
+  </info>
+  <fo>
+    <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
+      <fo:layout-master-set>
+        <fo:simple-page-master master-name="page" page-height="10cm" page-width="15cm" margin="1cm">
+          <fo:region-body background-color="#F0F0F0"/>
+        </fo:simple-page-master>
+      </fo:layout-master-set>
+
+      <!-- 1. separate border model, discarded borders, no header/footer -->
+      <fo:page-sequence master-reference="page" font-size="8pt" line-height="10pt">
+        <fo:flow flow-name="xsl-region-body">
+          <fo:block>1. Before the table</fo:block>
+          <fo:table width="100%" table-layout="fixed"
+            border-collapse="separate" border="2pt solid black">
+            <fo:table-column column-width="proportional-column-width(1)" number-columns-repeated="2"/>
+            <fo:table-body>
+              <fo:table-row border="2pt solid green">
+                <fo:table-cell border="inherit">
+                  <fo:block break-before="page">Cell 1.1</fo:block>
+                  <fo:block>Cell 1.1</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 1.2</fo:block>
+                  <fo:block>Cell 1.2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+              <fo:table-row border="2pt solid red">
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 2.1</fo:block>
+                  <fo:block>Cell 2.1</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 2.2</fo:block>
+                  <fo:block>Cell 2.2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+              <fo:table-row border="2pt solid orange">
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 3.1</fo:block>
+                  <fo:block>Cell 3.1</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 3.2</fo:block>
+                  <fo:block>Cell 3.2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+            </fo:table-body>
+          </fo:table>
+          <fo:block>After the table</fo:block>
+        </fo:flow>
+      </fo:page-sequence>
+
+      <!-- 2. separate border model, discarded borders, repeated header/footer -->
+      <fo:page-sequence master-reference="page" font-size="8pt" line-height="10pt">
+        <fo:flow flow-name="xsl-region-body">
+          <fo:block>2. Before the table</fo:block>
+          <fo:table width="100%" table-layout="fixed"
+            border-collapse="separate" border="2pt solid black"
+            table-omit-header-at-break="false" table-omit-footer-at-break="false">
+            <fo:table-column column-width="proportional-column-width(1)" number-columns-repeated="2"/>
+            <fo:table-header>
+              <fo:table-row border="2pt solid blue">
+                <fo:table-cell border="inherit"><fo:block>Header 1.1</fo:block></fo:table-cell>
+                <fo:table-cell border="inherit"><fo:block>Header 1.2</fo:block></fo:table-cell>
+              </fo:table-row>
+            </fo:table-header>
+            <fo:table-footer>
+              <fo:table-row border="2pt solid purple">
+                <fo:table-cell border="inherit"><fo:block>Footer 1.1</fo:block></fo:table-cell>
+                <fo:table-cell border="inherit"><fo:block>Footer 1.2</fo:block></fo:table-cell>
+              </fo:table-row>
+            </fo:table-footer>
+            <fo:table-body>
+              <fo:table-row border="2pt solid green">
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 1.1</fo:block>
+                  <fo:block>Cell 1.1</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="inherit">
+                  <fo:block break-before="page">Cell 1.2</fo:block>
+                  <fo:block>Cell 1.2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+              <fo:table-row border="2pt solid red">
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 2.1</fo:block>
+                  <fo:block>Cell 2.1</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 2.2</fo:block>
+                  <fo:block>Cell 2.2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+              <fo:table-row border="2pt solid orange">
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 3.1</fo:block>
+                  <fo:block>Cell 3.1</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 3.2</fo:block>
+                  <fo:block>Cell 3.2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+            </fo:table-body>
+          </fo:table>
+          <fo:block>After the table</fo:block>
+        </fo:flow>
+      </fo:page-sequence>
+
+      <!-- 3. separate border model, discarded borders, omitted header/footer -->
+      <fo:page-sequence master-reference="page" font-size="8pt" line-height="10pt">
+        <fo:flow flow-name="xsl-region-body">
+          <fo:block>3. Before the table</fo:block>
+          <fo:table width="100%" table-layout="fixed"
+            border-collapse="separate" border="2pt solid black"
+            table-omit-header-at-break="true" table-omit-footer-at-break="true">
+            <fo:table-column column-width="proportional-column-width(1)" number-columns-repeated="2"/>
+            <fo:table-header>
+              <fo:table-row border="2pt solid blue">
+                <fo:table-cell border="inherit"><fo:block>Header 1.1</fo:block></fo:table-cell>
+                <fo:table-cell border="inherit"><fo:block>Header 1.2</fo:block></fo:table-cell>
+              </fo:table-row>
+            </fo:table-header>
+            <fo:table-footer>
+              <fo:table-row border="2pt solid purple">
+                <fo:table-cell border="inherit"><fo:block>Footer 1.1</fo:block></fo:table-cell>
+                <fo:table-cell border="inherit"><fo:block>Footer 1.2</fo:block></fo:table-cell>
+              </fo:table-row>
+            </fo:table-footer>
+            <fo:table-body>
+              <fo:table-row border="2pt solid green">
+                <fo:table-cell border="inherit">
+                  <fo:block break-before="page">Cell 1.1</fo:block>
+                  <fo:block>Cell 1.1</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 1.2</fo:block>
+                  <fo:block>Cell 1.2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+              <fo:table-row border="2pt solid red">
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 2.1</fo:block>
+                  <fo:block>Cell 2.1</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 2.2</fo:block>
+                  <fo:block>Cell 2.2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+              <fo:table-row border="2pt solid orange">
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 3.1</fo:block>
+                  <fo:block>Cell 3.1</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 3.2</fo:block>
+                  <fo:block>Cell 3.2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+            </fo:table-body>
+          </fo:table>
+          <fo:block>After the table</fo:block>
+        </fo:flow>
+      </fo:page-sequence>
+
+      <!-- 4. collapsing border model, discarded borders, no header/footer -->
+      <fo:page-sequence master-reference="page" font-size="8pt" line-height="10pt">
+        <fo:flow flow-name="xsl-region-body">
+          <fo:block>4. Before the table</fo:block>
+          <fo:table width="100%" table-layout="fixed"
+            border-collapse="collapse" border="2pt solid black">
+            <fo:table-column column-width="proportional-column-width(1)" number-columns-repeated="2"/>
+            <fo:table-body>
+              <fo:table-row border="2pt solid green">
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 1.1</fo:block>
+                  <fo:block>Cell 1.1</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="inherit">
+                  <fo:block break-before="page">Cell 1.2</fo:block>
+                  <fo:block>Cell 1.2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+              <fo:table-row border="2pt solid red">
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 2.1</fo:block>
+                  <fo:block>Cell 2.1</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 2.2</fo:block>
+                  <fo:block>Cell 2.2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+              <fo:table-row border="2pt solid orange">
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 3.1</fo:block>
+                  <fo:block>Cell 3.1</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 3.2</fo:block>
+                  <fo:block>Cell 3.2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+            </fo:table-body>
+          </fo:table>
+          <fo:block>After the table</fo:block>
+        </fo:flow>
+      </fo:page-sequence>
+
+      <!-- 5. collapsing border model, discarded borders, repeated header/footer -->
+      <fo:page-sequence master-reference="page" font-size="8pt" line-height="10pt">
+        <fo:flow flow-name="xsl-region-body">
+          <fo:block>5. Before the table</fo:block>
+          <fo:table width="100%" table-layout="fixed"
+            border-collapse="collapse" border="2pt solid black"
+            table-omit-header-at-break="false" table-omit-footer-at-break="false">
+            <fo:table-column column-width="proportional-column-width(1)" number-columns-repeated="2"/>
+            <fo:table-header>
+              <fo:table-row border="2pt solid blue">
+                <fo:table-cell border="inherit"><fo:block>Header 1.1</fo:block></fo:table-cell>
+                <fo:table-cell border="inherit"><fo:block>Header 1.2</fo:block></fo:table-cell>
+              </fo:table-row>
+            </fo:table-header>
+            <fo:table-footer>
+              <fo:table-row border="2pt solid purple">
+                <fo:table-cell border="inherit"><fo:block>Footer 1.1</fo:block></fo:table-cell>
+                <fo:table-cell border="inherit"><fo:block>Footer 1.2</fo:block></fo:table-cell>
+              </fo:table-row>
+            </fo:table-footer>
+            <fo:table-body>
+              <fo:table-row border="2pt solid green">
+                <fo:table-cell border="inherit">
+                  <fo:block break-before="page">Cell 1.1</fo:block>
+                  <fo:block>Cell 1.1</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 1.2</fo:block>
+                  <fo:block>Cell 1.2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+              <fo:table-row border="2pt solid red">
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 2.1</fo:block>
+                  <fo:block>Cell 2.1</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 2.2</fo:block>
+                  <fo:block>Cell 2.2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+              <fo:table-row border="2pt solid orange">
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 3.1</fo:block>
+                  <fo:block>Cell 3.1</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 3.2</fo:block>
+                  <fo:block>Cell 3.2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+            </fo:table-body>
+          </fo:table>
+          <fo:block>After the table</fo:block>
+        </fo:flow>
+      </fo:page-sequence>
+
+      <!-- 6. collapsing border model, discarded borders, omitted header/footer -->
+      <fo:page-sequence master-reference="page" font-size="8pt" line-height="10pt">
+        <fo:flow flow-name="xsl-region-body">
+          <fo:block>6. Before the table</fo:block>
+          <fo:table width="100%" table-layout="fixed"
+            border-collapse="collapse" border="2pt solid black"
+            table-omit-header-at-break="true" table-omit-footer-at-break="true">
+            <fo:table-column column-width="proportional-column-width(1)" number-columns-repeated="2"/>
+            <fo:table-header>
+              <fo:table-row border="2pt solid blue">
+                <fo:table-cell border="inherit"><fo:block>Header 1.1</fo:block></fo:table-cell>
+                <fo:table-cell border="inherit"><fo:block>Header 1.2</fo:block></fo:table-cell>
+              </fo:table-row>
+            </fo:table-header>
+            <fo:table-footer>
+              <fo:table-row border="2pt solid purple">
+                <fo:table-cell border="inherit"><fo:block>Footer 1.1</fo:block></fo:table-cell>
+                <fo:table-cell border="inherit"><fo:block>Footer 1.2</fo:block></fo:table-cell>
+              </fo:table-row>
+            </fo:table-footer>
+            <fo:table-body>
+              <fo:table-row border="2pt solid green">
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 1.1</fo:block>
+                  <fo:block>Cell 1.1</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="inherit">
+                  <fo:block break-before="page">Cell 1.2</fo:block>
+                  <fo:block>Cell 1.2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+              <fo:table-row border="2pt solid red">
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 2.1</fo:block>
+                  <fo:block>Cell 2.1</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 2.2</fo:block>
+                  <fo:block>Cell 2.2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+              <fo:table-row border="2pt solid orange">
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 3.1</fo:block>
+                  <fo:block>Cell 3.1</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 3.2</fo:block>
+                  <fo:block>Cell 3.2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+            </fo:table-body>
+          </fo:table>
+          <fo:block>After the table</fo:block>
+        </fo:flow>
+      </fo:page-sequence>
+
+    </fo:root>
+  </fo>
+  <checks>
+
+    <!-- 1. separate border model, discarded borders, no header/footer -->
+    <!-- page 1 -->
+    <eval expected="2"                    xpath="count(//pageSequence[1]/pageViewport)"/>
+    <eval expected="1"                    xpath="count(//pageViewport[@nr='1']//flow/block)"/>
+    <eval expected="1. Before the table"  xpath="//pageViewport[@nr='1']//flow/block[1]//text"/>
+    <!-- page 2 -->
+    <eval expected="2"                    xpath="count(//pageViewport[@nr='2']//flow/block)"/>
+    <eval expected="After the table"      xpath="//pageViewport[@nr='2']//flow/block[2]//text"/>
+    <eval expected="72000"                xpath="//pageViewport[@nr='2']//flow/block[1]/@bpd"/>
+    <!--eval expected="76000"                xpath="//pageViewport[@nr='2']//flow/block[1]/@bpda"/-->
+    <!--eval expected="(solid,#000000,2000)" xpath="//pageViewport[@nr='2']//flow/block[1]/@border-before"/-->
+    <!--eval expected="(solid,#000000,2000)" xpath="//pageViewport[@nr='2']//flow/block[1]/@border-after"/-->
+    <!-- cell 1.1 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='2']//flow/block[1]/block[1]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='2']//flow/block[1]/block[1]/@bpda"/>
+    <eval expected="(solid,#008000,2000)" xpath="//pageViewport[@nr='2']//flow/block[1]/block[1]/@border-before"/>
+    <eval expected="(solid,#008000,2000)" xpath="//pageViewport[@nr='2']//flow/block[1]/block[1]/@border-after"/>
+    <!-- cell 1.2 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='2']//flow/block[1]/block[2]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='2']//flow/block[1]/block[2]/@bpda"/>
+    <eval expected="(solid,#008000,2000)" xpath="//pageViewport[@nr='2']//flow/block[1]/block[2]/@border-before"/>
+    <eval expected="(solid,#008000,2000)" xpath="//pageViewport[@nr='2']//flow/block[1]/block[2]/@border-after"/>
+    <!-- cell 2.1 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='2']//flow/block[1]/block[3]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='2']//flow/block[1]/block[3]/@bpda"/>
+    <eval expected="(solid,#ff0000,2000)" xpath="//pageViewport[@nr='2']//flow/block[1]/block[3]/@border-before"/>
+    <eval expected="(solid,#ff0000,2000)" xpath="//pageViewport[@nr='2']//flow/block[1]/block[3]/@border-after"/>
+    <!-- cell 2.2 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='2']//flow/block[1]/block[4]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='2']//flow/block[1]/block[4]/@bpda"/>
+    <eval expected="(solid,#ff0000,2000)" xpath="//pageViewport[@nr='2']//flow/block[1]/block[4]/@border-before"/>
+    <eval expected="(solid,#ff0000,2000)" xpath="//pageViewport[@nr='2']//flow/block[1]/block[4]/@border-after"/>
+    <!-- cell 3.1 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='2']//flow/block[1]/block[5]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='2']//flow/block[1]/block[5]/@bpda"/>
+    <eval expected="(solid,#ffa500,2000)" xpath="//pageViewport[@nr='2']//flow/block[1]/block[5]/@border-before"/>
+    <eval expected="(solid,#ffa500,2000)" xpath="//pageViewport[@nr='2']//flow/block[1]/block[5]/@border-after"/>
+    <!-- cell 3.2 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='2']//flow/block[1]/block[6]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='2']//flow/block[1]/block[6]/@bpda"/>
+    <eval expected="(solid,#ffa500,2000)" xpath="//pageViewport[@nr='2']//flow/block[1]/block[6]/@border-before"/>
+    <eval expected="(solid,#ffa500,2000)" xpath="//pageViewport[@nr='2']//flow/block[1]/block[6]/@border-after"/>
+
+    <!-- 2. separate border model, discarded borders, repeated header/footer -->
+    <!-- page 1 -->
+    <eval expected="2"                    xpath="count(//pageSequence[2]/pageViewport)"/>
+    <eval expected="1"                    xpath="count(//pageViewport[@nr='3']//flow/block)"/>
+    <eval expected="2. Before the table"  xpath="//pageViewport[@nr='3']//flow/block[1]//text"/>
+    <!-- page 2 -->
+    <eval expected="2"                    xpath="count(//pageViewport[@nr='4']//flow/block)"/>
+    <eval expected="After the table"      xpath="//pageViewport[@nr='4']//flow/block[2]//text"/>
+    <eval expected="100000"               xpath="//pageViewport[@nr='4']//flow/block[1]/@bpd"/>
+    <!--eval expected="104000"               xpath="//pageViewport[@nr='4']//flow/block[1]/@bpda"/-->
+    <!--eval expected="(solid,#000000,2000)" xpath="//pageViewport[@nr='4']//flow/block[1]/@border-before"/-->
+    <!--eval expected="(solid,#000000,2000)" xpath="//pageViewport[@nr='4']//flow/block[1]/@border-after"/-->
+    <!-- header 1.1 -->
+    <eval expected="10000"                xpath="//pageViewport[@nr='4']//flow/block[1]/block[1]/@bpd"/>
+    <eval expected="14000"                xpath="//pageViewport[@nr='4']//flow/block[1]/block[1]/@bpda"/>
+    <eval expected="(solid,#0000ff,2000)" xpath="//pageViewport[@nr='4']//flow/block[1]/block[1]/@border-before"/>
+    <eval expected="(solid,#0000ff,2000)" xpath="//pageViewport[@nr='4']//flow/block[1]/block[1]/@border-after"/>
+    <!-- header 1.2 -->
+    <eval expected="10000"                xpath="//pageViewport[@nr='4']//flow/block[1]/block[2]/@bpd"/>
+    <eval expected="14000"                xpath="//pageViewport[@nr='4']//flow/block[1]/block[2]/@bpda"/>
+    <eval expected="(solid,#0000ff,2000)" xpath="//pageViewport[@nr='4']//flow/block[1]/block[2]/@border-before"/>
+    <eval expected="(solid,#0000ff,2000)" xpath="//pageViewport[@nr='4']//flow/block[1]/block[2]/@border-after"/>
+    <!-- cell 1.1 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='4']//flow/block[1]/block[3]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='4']//flow/block[1]/block[3]/@bpda"/>
+    <eval expected="(solid,#008000,2000)" xpath="//pageViewport[@nr='4']//flow/block[1]/block[3]/@border-before"/>
+    <eval expected="(solid,#008000,2000)" xpath="//pageViewport[@nr='4']//flow/block[1]/block[3]/@border-after"/>
+    <!-- cell 1.2 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='4']//flow/block[1]/block[4]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='4']//flow/block[1]/block[4]/@bpda"/>
+    <eval expected="(solid,#008000,2000)" xpath="//pageViewport[@nr='4']//flow/block[1]/block[4]/@border-before"/>
+    <eval expected="(solid,#008000,2000)" xpath="//pageViewport[@nr='4']//flow/block[1]/block[4]/@border-after"/>
+    <!-- cell 2.1 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='4']//flow/block[1]/block[5]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='4']//flow/block[1]/block[5]/@bpda"/>
+    <eval expected="(solid,#ff0000,2000)" xpath="//pageViewport[@nr='4']//flow/block[1]/block[5]/@border-before"/>
+    <eval expected="(solid,#ff0000,2000)" xpath="//pageViewport[@nr='4']//flow/block[1]/block[5]/@border-after"/>
+    <!-- cell 2.2 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='4']//flow/block[1]/block[6]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='4']//flow/block[1]/block[6]/@bpda"/>
+    <eval expected="(solid,#ff0000,2000)" xpath="//pageViewport[@nr='4']//flow/block[1]/block[6]/@border-before"/>
+    <eval expected="(solid,#ff0000,2000)" xpath="//pageViewport[@nr='4']//flow/block[1]/block[6]/@border-after"/>
+    <!-- cell 3.1 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='4']//flow/block[1]/block[7]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='4']//flow/block[1]/block[7]/@bpda"/>
+    <eval expected="(solid,#ffa500,2000)" xpath="//pageViewport[@nr='4']//flow/block[1]/block[7]/@border-before"/>
+    <eval expected="(solid,#ffa500,2000)" xpath="//pageViewport[@nr='4']//flow/block[1]/block[7]/@border-after"/>
+    <!-- cell 3.2 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='4']//flow/block[1]/block[8]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='4']//flow/block[1]/block[8]/@bpda"/>
+    <eval expected="(solid,#ffa500,2000)" xpath="//pageViewport[@nr='4']//flow/block[1]/block[8]/@border-before"/>
+    <eval expected="(solid,#ffa500,2000)" xpath="//pageViewport[@nr='4']//flow/block[1]/block[8]/@border-after"/>
+    <!-- footer 1.1 -->
+    <eval expected="10000"                xpath="//pageViewport[@nr='4']//flow/block[1]/block[9]/@bpd"/>
+    <eval expected="14000"                xpath="//pageViewport[@nr='4']//flow/block[1]/block[9]/@bpda"/>
+    <eval expected="(solid,#800080,2000)" xpath="//pageViewport[@nr='4']//flow/block[1]/block[9]/@border-before"/>
+    <eval expected="(solid,#800080,2000)" xpath="//pageViewport[@nr='4']//flow/block[1]/block[9]/@border-after"/>
+    <!-- footer 1.2 -->
+    <eval expected="10000"                xpath="//pageViewport[@nr='4']//flow/block[1]/block[10]/@bpd"/>
+    <eval expected="14000"                xpath="//pageViewport[@nr='4']//flow/block[1]/block[10]/@bpda"/>
+    <eval expected="(solid,#800080,2000)" xpath="//pageViewport[@nr='4']//flow/block[1]/block[10]/@border-before"/>
+    <eval expected="(solid,#800080,2000)" xpath="//pageViewport[@nr='4']//flow/block[1]/block[10]/@border-after"/>
+
+    <!-- 3. separate border model, discarded borders, omitted header/footer -->
+    <!-- page 1 -->
+    <eval expected="2"                    xpath="count(//pageSequence[3]/pageViewport)"/>
+    <eval expected="1"                    xpath="count(//pageViewport[@nr='5']//flow/block)"/>
+    <eval expected="3. Before the table"  xpath="//pageViewport[@nr='5']//flow/block[1]//text"/>
+    <!-- page 2 -->
+    <eval expected="2"                    xpath="count(//pageViewport[@nr='6']//flow/block)"/>
+    <eval expected="After the table"      xpath="//pageViewport[@nr='6']//flow/block[2]//text"/>
+    <eval expected="100000"               xpath="//pageViewport[@nr='6']//flow/block[1]/@bpd"/>
+    <!--eval expected="104000"               xpath="//pageViewport[@nr='6']//flow/block[1]/@bpda"/-->
+    <!--eval expected="(solid,#000000,2000)" xpath="//pageViewport[@nr='6']//flow/block[1]/@border-before"/-->
+    <!--eval expected="(solid,#000000,2000)" xpath="//pageViewport[@nr='6']//flow/block[1]/@border-after"/-->
+    <!-- header 1.1 -->
+    <eval expected="10000"                xpath="//pageViewport[@nr='6']//flow/block[1]/block[1]/@bpd"/>
+    <eval expected="14000"                xpath="//pageViewport[@nr='6']//flow/block[1]/block[1]/@bpda"/>
+    <eval expected="(solid,#0000ff,2000)" xpath="//pageViewport[@nr='6']//flow/block[1]/block[1]/@border-before"/>
+    <eval expected="(solid,#0000ff,2000)" xpath="//pageViewport[@nr='6']//flow/block[1]/block[1]/@border-after"/>
+    <!-- header 1.2 -->
+    <eval expected="10000"                xpath="//pageViewport[@nr='6']//flow/block[1]/block[2]/@bpd"/>
+    <eval expected="14000"                xpath="//pageViewport[@nr='6']//flow/block[1]/block[2]/@bpda"/>
+    <eval expected="(solid,#0000ff,2000)" xpath="//pageViewport[@nr='6']//flow/block[1]/block[2]/@border-before"/>
+    <eval expected="(solid,#0000ff,2000)" xpath="//pageViewport[@nr='6']//flow/block[1]/block[2]/@border-after"/>
+    <!-- cell 1.1 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='6']//flow/block[1]/block[3]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='6']//flow/block[1]/block[3]/@bpda"/>
+    <eval expected="(solid,#008000,2000)" xpath="//pageViewport[@nr='6']//flow/block[1]/block[3]/@border-before"/>
+    <eval expected="(solid,#008000,2000)" xpath="//pageViewport[@nr='6']//flow/block[1]/block[3]/@border-after"/>
+    <!-- cell 1.2 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='6']//flow/block[1]/block[4]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='6']//flow/block[1]/block[4]/@bpda"/>
+    <eval expected="(solid,#008000,2000)" xpath="//pageViewport[@nr='6']//flow/block[1]/block[4]/@border-before"/>
+    <eval expected="(solid,#008000,2000)" xpath="//pageViewport[@nr='6']//flow/block[1]/block[4]/@border-after"/>
+    <!-- cell 2.1 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='6']//flow/block[1]/block[5]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='6']//flow/block[1]/block[5]/@bpda"/>
+    <eval expected="(solid,#ff0000,2000)" xpath="//pageViewport[@nr='6']//flow/block[1]/block[5]/@border-before"/>
+    <eval expected="(solid,#ff0000,2000)" xpath="//pageViewport[@nr='6']//flow/block[1]/block[5]/@border-after"/>
+    <!-- cell 2.2 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='6']//flow/block[1]/block[6]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='6']//flow/block[1]/block[6]/@bpda"/>
+    <eval expected="(solid,#ff0000,2000)" xpath="//pageViewport[@nr='6']//flow/block[1]/block[6]/@border-before"/>
+    <eval expected="(solid,#ff0000,2000)" xpath="//pageViewport[@nr='6']//flow/block[1]/block[6]/@border-after"/>
+    <!-- cell 3.1 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='6']//flow/block[1]/block[7]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='6']//flow/block[1]/block[7]/@bpda"/>
+    <eval expected="(solid,#ffa500,2000)" xpath="//pageViewport[@nr='6']//flow/block[1]/block[7]/@border-before"/>
+    <eval expected="(solid,#ffa500,2000)" xpath="//pageViewport[@nr='6']//flow/block[1]/block[7]/@border-after"/>
+    <!-- cell 3.2 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='6']//flow/block[1]/block[8]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='6']//flow/block[1]/block[8]/@bpda"/>
+    <eval expected="(solid,#ffa500,2000)" xpath="//pageViewport[@nr='6']//flow/block[1]/block[8]/@border-before"/>
+    <eval expected="(solid,#ffa500,2000)" xpath="//pageViewport[@nr='6']//flow/block[1]/block[8]/@border-after"/>
+    <!-- footer 1.1 -->
+    <eval expected="10000"                xpath="//pageViewport[@nr='6']//flow/block[1]/block[9]/@bpd"/>
+    <eval expected="14000"                xpath="//pageViewport[@nr='6']//flow/block[1]/block[9]/@bpda"/>
+    <eval expected="(solid,#800080,2000)" xpath="//pageViewport[@nr='6']//flow/block[1]/block[9]/@border-before"/>
+    <eval expected="(solid,#800080,2000)" xpath="//pageViewport[@nr='6']//flow/block[1]/block[9]/@border-after"/>
+    <!-- footer 1.2 -->
+    <eval expected="10000"                xpath="//pageViewport[@nr='6']//flow/block[1]/block[10]/@bpd"/>
+    <eval expected="14000"                xpath="//pageViewport[@nr='6']//flow/block[1]/block[10]/@bpda"/>
+    <eval expected="(solid,#800080,2000)" xpath="//pageViewport[@nr='6']//flow/block[1]/block[10]/@border-before"/>
+    <eval expected="(solid,#800080,2000)" xpath="//pageViewport[@nr='6']//flow/block[1]/block[10]/@border-after"/>
+
+    <!-- 4. collapsing border model, discarded borders, no header/footer -->
+    <!-- page 1 -->
+    <eval expected="2"                                   xpath="count(//pageSequence[4]/pageViewport)"/>
+    <eval expected="1"                                   xpath="count(//pageViewport[@nr='7']//flow/block)"/>
+    <eval expected="4. Before the table"                 xpath="//pageViewport[@nr='7']//flow/block[1]//text"/>
+    <!-- page 2 -->
+    <eval expected="2"                                   xpath="count(//pageViewport[@nr='8']//flow/block)"/>
+    <eval expected="After the table"                     xpath="//pageViewport[@nr='8']//flow/block[2]//text"/>
+    <eval expected="66000"                               xpath="//pageViewport[@nr='8']//flow/block[1]/@bpd"/>
+    <eval expected="66000"                               xpath="//pageViewport[@nr='8']//flow/block[1]/@bpda"/>
+    <!-- cell 1.1 -->
+    <eval expected="20000"                               xpath="//pageViewport[@nr='8']//flow/block[1]/block[1]/@bpd"/>
+    <eval expected="24000"                               xpath="//pageViewport[@nr='8']//flow/block[1]/block[1]/@bpda"/>
+    <eval expected="(solid,#008000,2000,collapse-outer)" xpath="//pageViewport[@nr='8']//flow/block[1]/block[1]/@border-before"/>
+    <eval expected="(solid,#008000,2000,collapse-inner)" xpath="//pageViewport[@nr='8']//flow/block[1]/block[1]/@border-after"/>
+    <!-- cell 1.2 -->
+    <eval expected="20000"                               xpath="//pageViewport[@nr='8']//flow/block[1]/block[2]/@bpd"/>
+    <eval expected="24000"                               xpath="//pageViewport[@nr='8']//flow/block[1]/block[2]/@bpda"/>
+    <eval expected="(solid,#008000,2000,collapse-outer)" xpath="//pageViewport[@nr='8']//flow/block[1]/block[2]/@border-before"/>
+    <eval expected="(solid,#008000,2000,collapse-inner)" xpath="//pageViewport[@nr='8']//flow/block[1]/block[2]/@border-after"/>
+    <!-- cell 2.1 -->
+    <eval expected="20000"                               xpath="//pageViewport[@nr='8']//flow/block[1]/block[3]/@bpd"/>
+    <eval expected="24000"                               xpath="//pageViewport[@nr='8']//flow/block[1]/block[3]/@bpda"/>
+    <eval expected="(solid,#ff0000,2000,collapse-inner)" xpath="//pageViewport[@nr='8']//flow/block[1]/block[3]/@border-before"/>
+    <eval expected="(solid,#ff0000,2000,collapse-inner)" xpath="//pageViewport[@nr='8']//flow/block[1]/block[3]/@border-after"/>
+    <!-- cell 2.2 -->
+    <eval expected="20000"                               xpath="//pageViewport[@nr='8']//flow/block[1]/block[4]/@bpd"/>
+    <eval expected="24000"                               xpath="//pageViewport[@nr='8']//flow/block[1]/block[4]/@bpda"/>
+    <eval expected="(solid,#ff0000,2000,collapse-inner)" xpath="//pageViewport[@nr='8']//flow/block[1]/block[4]/@border-before"/>
+    <eval expected="(solid,#ff0000,2000,collapse-inner)" xpath="//pageViewport[@nr='8']//flow/block[1]/block[4]/@border-after"/>
+    <!-- cell 3.1 -->
+    <eval expected="20000"                               xpath="//pageViewport[@nr='8']//flow/block[1]/block[5]/@bpd"/>
+    <eval expected="24000"                               xpath="//pageViewport[@nr='8']//flow/block[1]/block[5]/@bpda"/>
+    <eval expected="(solid,#ffa500,2000,collapse-inner)" xpath="//pageViewport[@nr='8']//flow/block[1]/block[5]/@border-before"/>
+    <eval expected="(solid,#ffa500,2000,collapse-outer)" xpath="//pageViewport[@nr='8']//flow/block[1]/block[5]/@border-after"/>
+    <!-- cell 3.2 -->
+    <eval expected="20000"                               xpath="//pageViewport[@nr='8']//flow/block[1]/block[6]/@bpd"/>
+    <eval expected="24000"                               xpath="//pageViewport[@nr='8']//flow/block[1]/block[6]/@bpda"/>
+    <eval expected="(solid,#ffa500,2000,collapse-inner)" xpath="//pageViewport[@nr='8']//flow/block[1]/block[6]/@border-before"/>
+    <eval expected="(solid,#ffa500,2000,collapse-outer)" xpath="//pageViewport[@nr='8']//flow/block[1]/block[6]/@border-after"/>
+
+    <!-- 5. collapsing border model, discarded borders, repeated header/footer -->
+    <!-- page 1 -->
+    <eval expected="2"                                   xpath="count(//pageSequence[5]/pageViewport)"/>
+    <eval expected="1"                                   xpath="count(//pageViewport[@nr='9']//flow/block)"/>
+    <eval expected="5. Before the table"                 xpath="//pageViewport[@nr='9']//flow/block[1]//text"/>
+    <!-- page 2 -->
+    <eval expected="2"                                   xpath="count(//pageViewport[@nr='10']//flow/block)"/>
+    <eval expected="After the table"                     xpath="//pageViewport[@nr='10']//flow/block[2]//text"/>
+    <eval expected="90000"                               xpath="//pageViewport[@nr='10']//flow/block[1]/@bpd"/>
+    <eval expected="90000"                               xpath="//pageViewport[@nr='10']//flow/block[1]/@bpda"/>
+    <!-- header 1.1 -->
+    <eval expected="10000"                               xpath="//pageViewport[@nr='10']//flow/block[1]/block[1]/@bpd"/>
+    <eval expected="14000"                               xpath="//pageViewport[@nr='10']//flow/block[1]/block[1]/@bpda"/>
+    <eval expected="(solid,#0000ff,2000,collapse-outer)" xpath="//pageViewport[@nr='10']//flow/block[1]/block[1]/@border-before"/>
+    <eval expected="(solid,#0000ff,2000,collapse-inner)" xpath="//pageViewport[@nr='10']//flow/block[1]/block[1]/@border-after"/>
+    <!-- header 1.2 -->
+    <eval expected="10000"                               xpath="//pageViewport[@nr='10']//flow/block[1]/block[2]/@bpd"/>
+    <eval expected="14000"                               xpath="//pageViewport[@nr='10']//flow/block[1]/block[2]/@bpda"/>
+    <eval expected="(solid,#0000ff,2000,collapse-outer)" xpath="//pageViewport[@nr='10']//flow/block[1]/block[2]/@border-before"/>
+    <eval expected="(solid,#0000ff,2000,collapse-inner)" xpath="//pageViewport[@nr='10']//flow/block[1]/block[2]/@border-after"/>
+    <!-- cell 1.1 -->
+    <eval expected="20000"                               xpath="//pageViewport[@nr='10']//flow/block[1]/block[3]/@bpd"/>
+    <eval expected="24000"                               xpath="//pageViewport[@nr='10']//flow/block[1]/block[3]/@bpda"/>
+    <eval expected="(solid,#008000,2000,collapse-inner)" xpath="//pageViewport[@nr='10']//flow/block[1]/block[3]/@border-before"/>
+    <eval expected="(solid,#008000,2000,collapse-inner)" xpath="//pageViewport[@nr='10']//flow/block[1]/block[3]/@border-after"/>
+    <!-- cell 1.2 -->
+    <eval expected="20000"                               xpath="//pageViewport[@nr='10']//flow/block[1]/block[4]/@bpd"/>
+    <eval expected="24000"                               xpath="//pageViewport[@nr='10']//flow/block[1]/block[4]/@bpda"/>
+    <eval expected="(solid,#008000,2000,collapse-inner)" xpath="//pageViewport[@nr='10']//flow/block[1]/block[4]/@border-before"/>
+    <eval expected="(solid,#008000,2000,collapse-inner)" xpath="//pageViewport[@nr='10']//flow/block[1]/block[4]/@border-after"/>
+    <!-- cell 2.1 -->
+    <eval expected="20000"                               xpath="//pageViewport[@nr='10']//flow/block[1]/block[5]/@bpd"/>
+    <eval expected="24000"                               xpath="//pageViewport[@nr='10']//flow/block[1]/block[5]/@bpda"/>
+    <eval expected="(solid,#ff0000,2000,collapse-inner)" xpath="//pageViewport[@nr='10']//flow/block[1]/block[5]/@border-before"/>
+    <eval expected="(solid,#ff0000,2000,collapse-inner)" xpath="//pageViewport[@nr='10']//flow/block[1]/block[5]/@border-after"/>
+    <!-- cell 2.2 -->
+    <eval expected="20000"                               xpath="//pageViewport[@nr='10']//flow/block[1]/block[6]/@bpd"/>
+    <eval expected="24000"                               xpath="//pageViewport[@nr='10']//flow/block[1]/block[6]/@bpda"/>
+    <eval expected="(solid,#ff0000,2000,collapse-inner)" xpath="//pageViewport[@nr='10']//flow/block[1]/block[6]/@border-before"/>
+    <eval expected="(solid,#ff0000,2000,collapse-inner)" xpath="//pageViewport[@nr='10']//flow/block[1]/block[6]/@border-after"/>
+    <!-- cell 3.1 -->
+    <eval expected="20000"                               xpath="//pageViewport[@nr='10']//flow/block[1]/block[7]/@bpd"/>
+    <eval expected="24000"                               xpath="//pageViewport[@nr='10']//flow/block[1]/block[7]/@bpda"/>
+    <eval expected="(solid,#ffa500,2000,collapse-inner)" xpath="//pageViewport[@nr='10']//flow/block[1]/block[7]/@border-before"/>
+    <eval expected="(solid,#ffa500,2000,collapse-inner)" xpath="//pageViewport[@nr='10']//flow/block[1]/block[7]/@border-after"/>
+    <!-- cell 3.2 -->
+    <eval expected="20000"                               xpath="//pageViewport[@nr='10']//flow/block[1]/block[8]/@bpd"/>
+    <eval expected="24000"                               xpath="//pageViewport[@nr='10']//flow/block[1]/block[8]/@bpda"/>
+    <eval expected="(solid,#ffa500,2000,collapse-inner)" xpath="//pageViewport[@nr='10']//flow/block[1]/block[8]/@border-before"/>
+    <eval expected="(solid,#ffa500,2000,collapse-inner)" xpath="//pageViewport[@nr='10']//flow/block[1]/block[8]/@border-after"/>
+    <!-- footer 1.1 -->
+    <eval expected="10000"                               xpath="//pageViewport[@nr='10']//flow/block[1]/block[9]/@bpd"/>
+    <eval expected="14000"                               xpath="//pageViewport[@nr='10']//flow/block[1]/block[9]/@bpda"/>
+    <eval expected="(solid,#800080,2000,collapse-inner)" xpath="//pageViewport[@nr='10']//flow/block[1]/block[9]/@border-before"/>
+    <eval expected="(solid,#800080,2000,collapse-outer)" xpath="//pageViewport[@nr='10']//flow/block[1]/block[9]/@border-after"/>
+    <!-- footer 1.2 -->
+    <eval expected="10000"                               xpath="//pageViewport[@nr='10']//flow/block[1]/block[10]/@bpd"/>
+    <eval expected="14000"                               xpath="//pageViewport[@nr='10']//flow/block[1]/block[10]/@bpda"/>
+    <eval expected="(solid,#800080,2000,collapse-inner)" xpath="//pageViewport[@nr='10']//flow/block[1]/block[10]/@border-before"/>
+    <eval expected="(solid,#800080,2000,collapse-outer)" xpath="//pageViewport[@nr='10']//flow/block[1]/block[10]/@border-after"/>
+
+    <!-- 6. collapsing border model, discarded borders, omitted header/footer -->
+    <!-- page 1 -->
+    <eval expected="2"                                   xpath="count(//pageSequence[6]/pageViewport)"/>
+    <eval expected="1"                                   xpath="count(//pageViewport[@nr='11']//flow/block)"/>
+    <eval expected="6. Before the table"                 xpath="//pageViewport[@nr='11']//flow/block[1]//text"/>
+    <!-- page 2 -->
+    <eval expected="2"                                   xpath="count(//pageViewport[@nr='12']//flow/block)"/>
+    <eval expected="After the table"                     xpath="//pageViewport[@nr='12']//flow/block[2]//text"/>
+    <eval expected="90000"                               xpath="//pageViewport[@nr='12']//flow/block[1]/@bpd"/>
+    <eval expected="90000"                               xpath="//pageViewport[@nr='12']//flow/block[1]/@bpda"/>
+    <!-- header 1.1 -->
+    <eval expected="10000"                               xpath="//pageViewport[@nr='12']//flow/block[1]/block[1]/@bpd"/>
+    <eval expected="14000"                               xpath="//pageViewport[@nr='12']//flow/block[1]/block[1]/@bpda"/>
+    <eval expected="(solid,#0000ff,2000,collapse-outer)" xpath="//pageViewport[@nr='12']//flow/block[1]/block[1]/@border-before"/>
+    <eval expected="(solid,#0000ff,2000,collapse-inner)" xpath="//pageViewport[@nr='12']//flow/block[1]/block[1]/@border-after"/>
+    <!-- header 1.2 -->
+    <eval expected="10000"                               xpath="//pageViewport[@nr='12']//flow/block[1]/block[2]/@bpd"/>
+    <eval expected="14000"                               xpath="//pageViewport[@nr='12']//flow/block[1]/block[2]/@bpda"/>
+    <eval expected="(solid,#0000ff,2000,collapse-outer)" xpath="//pageViewport[@nr='12']//flow/block[1]/block[2]/@border-before"/>
+    <eval expected="(solid,#0000ff,2000,collapse-inner)" xpath="//pageViewport[@nr='12']//flow/block[1]/block[2]/@border-after"/>
+    <!-- cell 1.1 -->
+    <eval expected="20000"                               xpath="//pageViewport[@nr='12']//flow/block[1]/block[3]/@bpd"/>
+    <eval expected="24000"                               xpath="//pageViewport[@nr='12']//flow/block[1]/block[3]/@bpda"/>
+    <eval expected="(solid,#008000,2000,collapse-inner)" xpath="//pageViewport[@nr='12']//flow/block[1]/block[3]/@border-before"/>
+    <eval expected="(solid,#008000,2000,collapse-inner)" xpath="//pageViewport[@nr='12']//flow/block[1]/block[3]/@border-after"/>
+    <!-- cell 1.2 -->
+    <eval expected="20000"                               xpath="//pageViewport[@nr='12']//flow/block[1]/block[4]/@bpd"/>
+    <eval expected="24000"                               xpath="//pageViewport[@nr='12']//flow/block[1]/block[4]/@bpda"/>
+    <eval expected="(solid,#008000,2000,collapse-inner)" xpath="//pageViewport[@nr='12']//flow/block[1]/block[4]/@border-before"/>
+    <eval expected="(solid,#008000,2000,collapse-inner)" xpath="//pageViewport[@nr='12']//flow/block[1]/block[4]/@border-after"/>
+    <!-- cell 2.1 -->
+    <eval expected="20000"                               xpath="//pageViewport[@nr='12']//flow/block[1]/block[5]/@bpd"/>
+    <eval expected="24000"                               xpath="//pageViewport[@nr='12']//flow/block[1]/block[5]/@bpda"/>
+    <eval expected="(solid,#ff0000,2000,collapse-inner)" xpath="//pageViewport[@nr='12']//flow/block[1]/block[5]/@border-before"/>
+    <eval expected="(solid,#ff0000,2000,collapse-inner)" xpath="//pageViewport[@nr='12']//flow/block[1]/block[5]/@border-after"/>
+    <!-- cell 2.2 -->
+    <eval expected="20000"                               xpath="//pageViewport[@nr='12']//flow/block[1]/block[6]/@bpd"/>
+    <eval expected="24000"                               xpath="//pageViewport[@nr='12']//flow/block[1]/block[6]/@bpda"/>
+    <eval expected="(solid,#ff0000,2000,collapse-inner)" xpath="//pageViewport[@nr='12']//flow/block[1]/block[6]/@border-before"/>
+    <eval expected="(solid,#ff0000,2000,collapse-inner)" xpath="//pageViewport[@nr='12']//flow/block[1]/block[6]/@border-after"/>
+    <!-- cell 3.1 -->
+    <eval expected="20000"                               xpath="//pageViewport[@nr='12']//flow/block[1]/block[7]/@bpd"/>
+    <eval expected="24000"                               xpath="//pageViewport[@nr='12']//flow/block[1]/block[7]/@bpda"/>
+    <eval expected="(solid,#ffa500,2000,collapse-inner)" xpath="//pageViewport[@nr='12']//flow/block[1]/block[7]/@border-before"/>
+    <eval expected="(solid,#ffa500,2000,collapse-inner)" xpath="//pageViewport[@nr='12']//flow/block[1]/block[7]/@border-after"/>
+    <!-- cell 3.2 -->
+    <eval expected="20000"                               xpath="//pageViewport[@nr='12']//flow/block[1]/block[8]/@bpd"/>
+    <eval expected="24000"                               xpath="//pageViewport[@nr='12']//flow/block[1]/block[8]/@bpda"/>
+    <eval expected="(solid,#ffa500,2000,collapse-inner)" xpath="//pageViewport[@nr='12']//flow/block[1]/block[8]/@border-before"/>
+    <eval expected="(solid,#ffa500,2000,collapse-inner)" xpath="//pageViewport[@nr='12']//flow/block[1]/block[8]/@border-after"/>
+    <!-- footer 1.1 -->
+    <eval expected="10000"                               xpath="//pageViewport[@nr='12']//flow/block[1]/block[9]/@bpd"/>
+    <eval expected="14000"                               xpath="//pageViewport[@nr='12']//flow/block[1]/block[9]/@bpda"/>
+    <eval expected="(solid,#800080,2000,collapse-inner)" xpath="//pageViewport[@nr='12']//flow/block[1]/block[9]/@border-before"/>
+    <eval expected="(solid,#800080,2000,collapse-outer)" xpath="//pageViewport[@nr='12']//flow/block[1]/block[9]/@border-after"/>
+    <!-- footer 1.2 -->
+    <eval expected="10000"                               xpath="//pageViewport[@nr='12']//flow/block[1]/block[10]/@bpd"/>
+    <eval expected="14000"                               xpath="//pageViewport[@nr='12']//flow/block[1]/block[10]/@bpda"/>
+    <eval expected="(solid,#800080,2000,collapse-inner)" xpath="//pageViewport[@nr='12']//flow/block[1]/block[10]/@border-before"/>
+    <eval expected="(solid,#800080,2000,collapse-outer)" xpath="//pageViewport[@nr='12']//flow/block[1]/block[10]/@border-after"/>
+
+  </checks>
+</testcase>
index 780d60015456b2510946364d1442d554023a6b5b..b79176be60a99fd81dcbfd8e0184064c95a891e1 100644 (file)
@@ -19,9 +19,9 @@
 <testcase>
   <info>
     <p>
-      This test checks that break-before set on table-rows work correctly in various conditions:
-      when headers/footers shall be repeated at page breaks or not, in the separate or collapsing
-      border model, etc.
+      This test checks that break-before set on blocks in table-cells works correctly in various
+      conditions: when headers/footers shall be repeated at page breaks or not, in the separate or
+      collapsing border model, etc.
     </p>
   </info>
   <fo>
diff --git a/test/layoutengine/standard-testcases/table-cell_row-span_breaks.xml b/test/layoutengine/standard-testcases/table-cell_row-span_breaks.xml
new file mode 100644 (file)
index 0000000..f00d989
--- /dev/null
@@ -0,0 +1,197 @@
+<?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 that breaks on blocks inside cells work correctly when row spanning is in
+      progress.
+    </p>
+  </info>
+  <fo>
+    <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
+      <fo:layout-master-set>
+        <fo:simple-page-master master-name="page" page-height="4in" page-width="5in" margin="0.5in">
+          <fo:region-body background-color="#F0F0F0"/>
+        </fo:simple-page-master>
+      </fo:layout-master-set>
+
+      <!-- table 1 -->
+      <fo:page-sequence master-reference="page" font-size="8pt" line-height="10pt">
+        <fo:flow flow-name="xsl-region-body">
+          <fo:block>Before the table</fo:block>
+          <fo:table width="100%" table-layout="fixed"
+            border-collapse="separate" border="2pt solid black">
+            <fo:table-column column-width="proportional-column-width(1)" number-columns-repeated="2"/>
+            <fo:table-body border="2pt solid blue">
+              <fo:table-row border="inherit">
+                <fo:table-cell border="inherit" number-rows-spanned="2">
+                  <fo:block>Cell 1.1 Line 1</fo:block>
+                  <fo:block>Cell 1.1 Line 2</fo:block>
+                  <fo:block>Cell 1.1 Line 3</fo:block>
+                  <fo:block>Cell 1.1 Line 4</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="inherit" border-color="red">
+                  <fo:block>Cell 1.2 Line 1</fo:block>
+                  <fo:block break-after="page">Cell 1.2 Line 2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+              <fo:table-row border="inherit">
+                <fo:table-cell border="inherit">
+                  <fo:block>Cell 2.2 Line 1</fo:block>
+                  <fo:block>Cell 2.2 Line 2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+            </fo:table-body>
+          </fo:table>
+          <fo:block>After the table</fo:block>
+        </fo:flow>
+      </fo:page-sequence>
+
+      <!-- table 2 -->
+      <!-- the break-before="odd-page" on cell 2.1 should win over the break-after="page" of
+           cell 1.1 -->
+      <fo:page-sequence master-reference="page" font-size="8pt" line-height="10pt">
+        <fo:flow flow-name="xsl-region-body">
+          <fo:block>Before the table</fo:block>
+          <fo:table width="100%" table-layout="fixed"
+            border-collapse="separate" border="2pt solid black">
+            <fo:table-column column-width="proportional-column-width(1)" number-columns-repeated="2"/>
+            <fo:table-body border="2pt solid blue">
+              <fo:table-row border="inherit">
+                <fo:table-cell border="inherit" border-color="red">
+                  <fo:block>Cell 1.1 Line 1</fo:block>
+                  <fo:block break-after="page">Cell 1.1 Line 2</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="inherit" number-rows-spanned="2">
+                  <fo:block>Cell 1.2 Line 1</fo:block>
+                  <fo:block>Cell 1.2 Line 2</fo:block>
+                  <fo:block>Cell 1.2 Line 3</fo:block>
+                  <fo:block>Cell 1.2 Line 4</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+              <fo:table-row border="inherit">
+                <fo:table-cell border="inherit" border-color="red">
+                  <fo:block break-before="odd-page">Cell 2.1 Line 1</fo:block>
+                  <fo:block>Cell 2.1 Line 2</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+            </fo:table-body>
+          </fo:table>
+          <fo:block>After the table</fo:block>
+        </fo:flow>
+      </fo:page-sequence>
+
+    </fo:root>
+  </fo>
+  <checks>
+
+    <!-- table 1 -->
+    <!-- page 1 -->
+    <eval expected="2"                    xpath="count(//pageSequence[1]/pageViewport)"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='1']//flow/block[2]/@bpd"/>
+    <eval expected="26000"                xpath="//pageViewport[@nr='1']//flow/block[2]/@bpda"/>
+    <eval expected="(solid,#000000,2000)" xpath="//pageViewport[@nr='1']//flow/block[2]/@border-before"/>
+    <eval expected=""                     xpath="//pageViewport[@nr='1']//flow/block[2]/@border-after"/>
+    <!-- cell 1.1 -->
+    <eval expected="22000"                xpath="//pageViewport[@nr='1']//flow/block[2]/block[1]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='1']//flow/block[2]/block[1]/@bpda"/>
+    <eval expected="(solid,#0000ff,2000)" xpath="//pageViewport[@nr='1']//flow/block[2]/block[1]/@border-before"/>
+    <eval expected=""                     xpath="//pageViewport[@nr='1']//flow/block[2]/block[1]/@border-after"/>
+    <eval expected="2"              xpath="count(//pageViewport[@nr='1']//flow/block[2]/block[1]/block)"/>
+    <eval expected="Cell 1.1 Line 1"      xpath="//pageViewport[@nr='1']//flow/block[2]/block[1]/block[1]"/>
+    <eval expected="Cell 1.1 Line 2"      xpath="//pageViewport[@nr='1']//flow/block[2]/block[1]/block[2]"/>
+    <!-- cell 1.2 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='1']//flow/block[2]/block[2]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='1']//flow/block[2]/block[2]/@bpda"/>
+    <eval expected="(solid,#ff0000,2000)" xpath="//pageViewport[@nr='1']//flow/block[2]/block[2]/@border-before"/>
+    <eval expected="(solid,#ff0000,2000)" xpath="//pageViewport[@nr='1']//flow/block[2]/block[2]/@border-after"/>
+    <eval expected="2"              xpath="count(//pageViewport[@nr='1']//flow/block[2]/block[2]/block)"/>
+    <eval expected="Cell 1.2 Line 1"      xpath="//pageViewport[@nr='1']//flow/block[2]/block[2]/block[1]"/>
+    <eval expected="Cell 1.2 Line 2"      xpath="//pageViewport[@nr='1']//flow/block[2]/block[2]/block[2]"/>
+    <!-- page 2 -->
+    <eval expected="24000"                xpath="//pageViewport[@nr='2']//flow/block[1]/@bpd"/>
+    <eval expected="26000"                xpath="//pageViewport[@nr='2']//flow/block[1]/@bpda"/>
+    <eval expected=""                     xpath="//pageViewport[@nr='2']//flow/block[1]/@border-before"/>
+    <eval expected="(solid,#000000,2000)" xpath="//pageViewport[@nr='2']//flow/block[1]/@border-after"/>
+    <!-- cell 1.1 -->
+    <eval expected="22000"                xpath="//pageViewport[@nr='2']//flow/block[1]/block[1]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='2']//flow/block[1]/block[1]/@bpda"/>
+    <eval expected=""                     xpath="//pageViewport[@nr='2']//flow/block[1]/block[1]/@border-before"/>
+    <eval expected="(solid,#0000ff,2000)" xpath="//pageViewport[@nr='2']//flow/block[1]/block[1]/@border-after"/>
+    <eval expected="2"              xpath="count(//pageViewport[@nr='2']//flow/block[1]/block[1]/block)"/>
+    <eval expected="Cell 1.1 Line 3"      xpath="//pageViewport[@nr='2']//flow/block[1]/block[1]/block[1]"/>
+    <eval expected="Cell 1.1 Line 4"      xpath="//pageViewport[@nr='2']//flow/block[1]/block[1]/block[2]"/>
+    <!-- cell 2.2 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='2']//flow/block[1]/block[2]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='2']//flow/block[1]/block[2]/@bpda"/>
+    <eval expected="(solid,#0000ff,2000)" xpath="//pageViewport[@nr='2']//flow/block[1]/block[2]/@border-before"/>
+    <eval expected="(solid,#0000ff,2000)" xpath="//pageViewport[@nr='2']//flow/block[1]/block[2]/@border-after"/>
+    <eval expected="2"              xpath="count(//pageViewport[@nr='2']//flow/block[1]/block[2]/block)"/>
+    <eval expected="Cell 2.2 Line 1"      xpath="//pageViewport[@nr='2']//flow/block[1]/block[2]/block[1]"/>
+    <eval expected="Cell 2.2 Line 2"      xpath="//pageViewport[@nr='2']//flow/block[1]/block[2]/block[2]"/>
+
+    <!-- table 2 -->
+    <!-- page 1 -->
+    <eval expected="3"                    xpath="count(//pageSequence[2]/pageViewport)"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='3']//flow/block[2]/@bpd"/>
+    <eval expected="26000"                xpath="//pageViewport[@nr='3']//flow/block[2]/@bpda"/>
+    <eval expected="(solid,#000000,2000)" xpath="//pageViewport[@nr='3']//flow/block[2]/@border-before"/>
+    <eval expected=""                     xpath="//pageViewport[@nr='3']//flow/block[2]/@border-after"/>
+    <!-- cell 1.1 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='3']//flow/block[2]/block[1]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='3']//flow/block[2]/block[1]/@bpda"/>
+    <eval expected="(solid,#ff0000,2000)" xpath="//pageViewport[@nr='3']//flow/block[2]/block[1]/@border-before"/>
+    <eval expected="(solid,#ff0000,2000)" xpath="//pageViewport[@nr='3']//flow/block[2]/block[1]/@border-after"/>
+    <eval expected="2"              xpath="count(//pageViewport[@nr='3']//flow/block[2]/block[1]/block)"/>
+    <eval expected="Cell 1.1 Line 1"      xpath="//pageViewport[@nr='3']//flow/block[2]/block[1]/block[1]"/>
+    <eval expected="Cell 1.1 Line 2"      xpath="//pageViewport[@nr='3']//flow/block[2]/block[1]/block[2]"/>
+    <!-- cell 1.2 -->
+    <eval expected="22000"                xpath="//pageViewport[@nr='3']//flow/block[2]/block[2]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='3']//flow/block[2]/block[2]/@bpda"/>
+    <eval expected="(solid,#0000ff,2000)" xpath="//pageViewport[@nr='3']//flow/block[2]/block[2]/@border-before"/>
+    <eval expected=""                     xpath="//pageViewport[@nr='3']//flow/block[2]/block[2]/@border-after"/>
+    <eval expected="2"              xpath="count(//pageViewport[@nr='3']//flow/block[2]/block[2]/block)"/>
+    <eval expected="Cell 1.2 Line 1"      xpath="//pageViewport[@nr='3']//flow/block[2]/block[2]/block[1]"/>
+    <eval expected="Cell 1.2 Line 2"      xpath="//pageViewport[@nr='3']//flow/block[2]/block[2]/block[2]"/>
+    <!-- page 3 -->
+    <eval expected="0"              xpath="count(//pageViewport[@nr='4']//flow/block)"/>
+    <!-- page 2 -->
+    <eval expected="24000"                xpath="//pageViewport[@nr='5']//flow/block[1]/@bpd"/>
+    <eval expected="26000"                xpath="//pageViewport[@nr='5']//flow/block[1]/@bpda"/>
+    <eval expected=""                     xpath="//pageViewport[@nr='5']//flow/block[1]/@border-before"/>
+    <eval expected="(solid,#000000,2000)" xpath="//pageViewport[@nr='5']//flow/block[1]/@border-after"/>
+    <!-- cell 1.1 -->
+    <eval expected="20000"                xpath="//pageViewport[@nr='5']//flow/block[1]/block[1]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='5']//flow/block[1]/block[1]/@bpda"/>
+    <eval expected="(solid,#ff0000,2000)" xpath="//pageViewport[@nr='5']//flow/block[1]/block[1]/@border-before"/>
+    <eval expected="(solid,#ff0000,2000)" xpath="//pageViewport[@nr='5']//flow/block[1]/block[1]/@border-after"/>
+    <eval expected="2"              xpath="count(//pageViewport[@nr='5']//flow/block[1]/block[1]/block)"/>
+    <eval expected="Cell 2.1 Line 1"      xpath="//pageViewport[@nr='5']//flow/block[1]/block[1]/block[1]"/>
+    <eval expected="Cell 2.1 Line 2"      xpath="//pageViewport[@nr='5']//flow/block[1]/block[1]/block[2]"/>
+    <!-- cell 1.2 -->
+    <eval expected="22000"                xpath="//pageViewport[@nr='5']//flow/block[1]/block[2]/@bpd"/>
+    <eval expected="24000"                xpath="//pageViewport[@nr='5']//flow/block[1]/block[2]/@bpda"/>
+    <eval expected=""                     xpath="//pageViewport[@nr='5']//flow/block[1]/block[2]/@border-before"/>
+    <eval expected="(solid,#0000ff,2000)" xpath="//pageViewport[@nr='5']//flow/block[1]/block[2]/@border-after"/>
+    <eval expected="2"              xpath="count(//pageViewport[@nr='5']//flow/block[1]/block[2]/block)"/>
+    <eval expected="Cell 1.2 Line 3"      xpath="//pageViewport[@nr='5']//flow/block[1]/block[2]/block[1]"/>
+    <eval expected="Cell 1.2 Line 4"      xpath="//pageViewport[@nr='5']//flow/block[1]/block[2]/block[2]"/>
+
+  </checks>
+</testcase>