"Body" Region Margin and "Side" Region Extent

This section provides tutorial example to demonstrate how the region-before extent overlaps with the top margin of the region-body. It can also be extended into and hidden behind the content area of the region-body.

One of common issues of using a "side" region in a simple-page-master layout is to know how to control its extent="..." attribute. Here are two rules that may be helpful to you in designing "side" regions:

1. The location and size of the "body" region are independent of "side" regions. In other words, the "region-body" content area size is always equal to the page size after removing the layout margin and its own margin.

For example, if a simple-page-master layout has a 8.5in by 11in page size, and a 0.5in layout margin, the region-body with a 1.2in margin will result a region-body content area of 8.5 - 2*0.5 - 2*1.2 = 5.1 inch wide and 11 - 2*0.5 - 2*1.2 = 7.6 inch high.

2. If a "side" region is added, its width is determined by its extent="..." attribute. Its outer side is aligned to the outer side of the margin area of the "body" region.

In other words, a "side" region is always overlapped with the margin portion of the "body" region. If the "side" region is too wide, it will be extended into and "hidden" behind the content portion of the "body" region.

For example, if the region-body has a 1.2in margin, a region-before with a 1.5in extent will overlap the region-body top margin and a 0.3in portion will be "hidden" behind the region-body content area.

To demonstrate these rules, I wrote the following XSL-FO document: region-before-Extented-Too-Wide.fo.

<?xml version="1.1" encoding="utf-8"?>
<!-- region-before-Extented-Too-Wide.fo
 - Copyright (c) 2006 HerongYang.com. All Rights Reserved.
-->
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
 <fo:layout-master-set>
  <fo:simple-page-master master-name="my_page" margin="0.5in" 
   page-height="11in" page-width="8.5in"
   reference-orientation="0" writing-mode="lr-tb">
   <fo:region-body region-name="my_body" background-color="#eeeeee"
   margin="1.2in" reference-orientation="0" writing-mode="lr-tb"/>
   <fo:region-before region-name="my_header" background-color="#ffeeee"
   extent="1.5in" reference-orientation="0" writing-mode="lr-tb"/>
  </fo:simple-page-master>
 </fo:layout-master-set>
 <fo:page-sequence master-reference="my_page">
  <fo:static-content flow-name="my_header">
   <fo:block>&lt;region-before extent="1.5in" ...&gt;</fo:block>
  </fo:static-content>
  <fo:flow flow-name="my_body">
   <fo:block>&lt;region-body margin="1.2in" ...&gt;</fo:block>
  </fo:flow>
 </fo:page-sequence>
</fo:root>

The quickest way to see the output of this example XSL-FO document to process it with Apache FOP tool on the AWT window:

herong> fop -fo region-before-Extented-Too-Wide.fo -awt

You should see a page displaying the "before" region in pink and the "body" region in gray as shown below:

region-body Margin and region-before Extent
region-body Margin and region-before Extent

Note that the "before" region is extended to cover the entire top margin of the "body" region and overlapped partially with the content area of the "body" region.

Table of Contents

 About This Book

 Introduction of XSL-FO

 Apache™ FOP (Formatting Objects Processor)

 RenderX XEP as an XSL-FO Tool

 Introduction of Area Model

 XSL-FO Document Basics and Examples

Page Layout Masters

 Layout Declarations

 simple-page-master - Simple Page Layout

 simple-page-master Attributes and Sub Elements

 simple-page-master/region-body Sub Element

 region-before and region-after Sub Elements

 region-start and region-end Sub Elements

"Body" Region Margin and "Side" Region Extent

 Precedence of Side Region Corners

 Page Layout and Page Sequence Mapping

 What Is "page-sequence-master"

 Layout Sequence Example - Cover and Content

 Wheat Is "repeatable-page-master-alternatives"?

 Layout Sequence Example - Odd and Even Pages

 Block-Level Formatting Objects

 Inline-Level Formatting Objects

 Including Graphics in XSL-FO document

 Table of Rows and Columns

 List, Item, Label, and Body

 Floating Blocks - "float" and "footnote"

 Hyperlinks, Table of Contents and Indexes

 Headers and Footers using "static-content"

 Font Attributes and Font Families

 Apache FOP Font Configurations

 RenderX XEP Font Configurations

 Converting HTML to PDF

 References

 Full Version in PDF/ePUB