XSL-FO Tutorials - Herong's Tutorial Examples - v2.25, by Herong Yang
Precedence of Side Region Corners
This section provides tutorial example to demonstrate that the 'start' or 'end' region wins the corner area against the 'before' or 'after' region when two adjacent 'side' regions are declared by default. If the 'start' or 'end' region wants to win, it must have precedence='true' specified.
Another common issue of using "side" regions in a simple-page-master layout is to know how to control the corner area of two adjacent "side" regions. Here are rules that may be helpful to you in designing "side" regions:
1. By default, the "start" or "end" region wins the corner area against the "before" or "after" region when two adjacent "side" regions are declared.
2. If the "start" or "end" region wants to win the corner area, it must have precedence="true" specified when two adjacent "side" regions are declared.
To demonstrate these rules, I wrote the following XSL-FO document: Precedence-of-Side-Region-Corner.fo.
<?xml version="1.1" encoding="utf-8"?> <!-- Precedence-of-Side-Region-Corner.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" precedence="false"/> <fo:region-after/> <fo:region-start region-name="my_sidebar" background-color="#eeffff" extent="1.5in" reference-orientation="-90" writing-mode="lr-tb"/> <fo:region-end/> </fo:simple-page-master> </fo:layout-master-set> <fo:page-sequence master-reference="my_page"> <fo:static-content flow-name="my_header"> <fo:block><region-before extent="1.5in" ...></fo:block> </fo:static-content> <fo:static-content flow-name="my_sidebar"> <fo:block>< region-start</fo:block> <fo:block>extent="1.5in" ...</fo:block> </fo:static-content> <fo:flow flow-name="my_body"> <fo:block><region-body margin="1.2in" ...></fo:block> </fo:flow> </fo:page-sequence> </fo:root>
You can process this example XSL-FO document with Apache FOP tool on the AWT window:
herong> fop -fo Precedence-of-Side-Region-Corner.fo -awt
You should see a page displaying the "before" region in pink, the "start" region in light blue, and the "body" region in gray as shown below:
Note that the "start" region wins the top left corner area adjacent to "start" and "before" regions, because <fo:region-before precedence="false" ...> is specified. This is also the default behavior.
Table of Contents
Apache™ FOP (Formatting Objects Processor)
XSL-FO Document Basics and Examples
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
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