Here we review the area model and how areas interact with each other and within defined regions of the page. Understanding areas and pages is critical to writing successful XSL-FO instances.
Area model. The rendering process renders the area tree created by formatting objects. Thus, to get the desired rendered result, one must know how to position and nest areas of content and set their traits. Formatting objects are chosen to give the desired layout result, but note that the names of formatting objects may be totally irrelevant to the reason they are used in an XSL-FO instance to get the particular areas desired.
The area model describes the nature of the areas of content that are created for rendering from the formatting specification. XSL-FO 1.0 only defines rectangular areas (some of which of course may be square) in the area model, and these areas are arranged in hierarchical order in the area tree. Child areas that stack normally are arranged within their parent's area. A given formatting object may add areas to multiple branches of the hierarchy, thus placing areas outside of their parent's area. Objects in a given branch of the area tree typically stack next to each other.
There are many different types of areas that define the formatter's behavior for the content of the areas, as depicted in the four rectangles shown in Figure 4-1. An area is spaced between its siblings and within the content rectangle of its parent using a transparent spacing specification in the outermost rectangle. An opaque border may be specified around content where the thickness of the border is defined by the distances between respective edges of two rectangles: the border rectangle (outside edge) and the padding rectangle (inside edge). The border may also be patterned , and if so, any background to the border is transparent and shows through the parent's area. The border is distanced from the area's content rectangle by transparent padding. Note in the left example how these rectangles are coincident when there is no border or padding.
Figure 4-1. The rectangles describing an area
The number of rectangles in play and their nuances can be overwhelming to the novice stylesheet writer. Thankfully, it is not necessary to know all the rectangles to get simple, good quality results. It is, however, important to be aware of the different rectangles to better understand the interplay of areas and the controls available in XSL-FO properties, especially when your requirements evolve beyond simple arrangements of your information.
The two concepts of writing direction and reference orientation govern the visual placement of areas on a page. These values define the block-progression and inline-progression directions for the stacking of descendants of an area. Their combinations support natural directions for common writing systems of the world, and the orientation can be overridden to produce special effects in the rendered result. These values also define the before and after sides in the block-progression direction and the start and end sides in the inline-progression direction.
Most child areas inherit unspecified behaviors from the parent areas. Block and inline content stack in the layout areas as specified by the stacking properties, and it is often not necessary to specify most behaviors as these are already implied from the ancestral areas.
Child "container" objects are used to create areas that override orientation behavior specified by an ancestral area. Areas created by container objects can alter their behavior to meet specific requirements that differ from those of the parent area. As examples, consider specifying an absolute position outside of the parent for a block container; or specifying an overflow behavior; or specifying a writing direction or reference orientation that is different from that of the parent. Both block-level and inline-level container objects can be used within their respective types of parent objects.
Areas on the page are not mutually exclusive. Areas can be formatted to overlap other areas in whole or in part, and when they overlap and the backgrounds are transparent, the areas behind show through. Common formatting problems occur when areas from different branches of the tree occupy the same real estate on the page, so you must plan ahead so the stacking of areas in one branch doesn't interfere with the stacking of areas in other branches.
Page geometry. A page in XSL-FO is described by the geometry of its size and the various regions and sub-regions on the page where information is placed by the formatting objects, as shown in Figure 4-2. Note in this diagram that the page on the left has page margins but no body region margins, therefore the body region perimeter matches locations of the page margins. In the two pages on the right, the body region has margins pulling in the perimeter away from the page margins. In each case all four perimeter regions are defined, the default is shown in the center where the before and after regions are bounded within the extents of the start and end regions whose perimeters extend to the page margins. On the right hand page, the precedence of the before and after regions has been changed to override the start and end regions, thus extending their respective perimeters to the page margins.
Figure 4-2. Regions and sub-regions of a page
Every page has a region-body region whose default name is " xsl-region-body ". This is typically (but not necessarily ) the region receiving the flow that triggers the pagination and generation of pages.
Four available perimeter regions defined by region-before , region-after , region-start , and region-end can incur into the body region along its four edges. The writing direction and reference orientation of the page reference area defined by the page geometry determine the before, after, start, and end edges of the body for the perimeter regions. The precedence property on region-before and region-after dictates whether the before/after regions or start/end regions occupy the corners of the perimeter. These four regions have the initial names, respectively, of " xsl-region-before ", " xsl-region-after ", " xsl-region-start ", and " xsl-region-end ".
Regions are referenced in XSL-FO by their names, which can be changed from their initial values by the user .
The five available page regions in the simple geometry of XSL-FO 1.0 are targets for either paginated flow or static content.
The paginated flow triggers as many pages as needed by the amount of the flowed content. When a page's region accepting flow overflows, a new page in the page sequence is triggered to accommodate the continuing flow of content. The flow indicates the name of the target region for the content.
Each page that is triggered by the amount of flow instantiates all regions for the page. The user can define static content for regions, indicating to which named region the static content is targeted . Whenever the named region is created by its presence on a new page, the static content is placed into the region. The static content can have dynamic components such as the page number or the content of user-defined markers appearing on the page being formatted.
Page regions are parents and ancestors of the formatting objects flowed (for paginated content) or copied (for static content) in the region. Therefore, the formatting objects in each region are descendant areas of that region's branch in the area tree, so the sibling areas in each branch stack separately from the sibling areas in other branches. Without proper body region margins, the perimeter region areas and the body region areas will overlap.
Included in this chapter. This chapter includes discussion of the following XSL-FO objects.
Content-oriented formatting objects:
Container formatting objects:
Page-oriented formatting objects: