Xsl Fo Table Formatting Assignment

6 Formatting Objects

6.1 Introduction to Formatting Objects

The refined formatting object tree describes one or more intended presentations of the information within this tree. Formatting is the process which converts the description into a presentation. See [3 Introduction to Formatting]. The presentation is represented, abstractly, by an area tree, as defined in the area model. See [4 Area Model]. Each possible presentation is represented by one or more area trees in which the information in the refined formatting object tree is positioned on a two and one-half dimensional surface.

There are three kinds of formatting objects: (1) those that generate areas, (2) those that return areas, but do not generate them, and (3) those that are used in the generation of areas. The first and second kinds are typically called flow objects. The third kind is either a layout object or an auxiliary object. The kind of formatting object is indicated by the terminology used with the object. Formatting objects of the first kind are said to "generate one or more areas". Formatting objects of the second kind are said to "return one or more areas". Formatting objects of the first kind may both generate and return areas. Formatting objects of the third kind are "used in the generation of areas"; that is, they act like parameters to the generation process.

6.1.1 Definitions Common to Many Formatting Objects

This categorization leads to defining two traits which characterize the relationship between an area and the formatting objects which generate and return that area. These traits are generated-by and returned-by.

The value of the generated-by trait is a single formatting object. A formatting object is defined to generate an area if the semantics of specify the generation of one or more areas and is one of the areas thus generated, or is a substituted form of one of the areas thus generated, as specified in section [4.7.2 Line-building].

In the case of substituted glyph-areas, the generating formatting object is deemed to be the formatting object which generated the glyph-area which comes first in the sequence of substituted glyph-areas. In the case of an inserted glyph-area (e.g., an automatically-generated hyphen) the generating formatting object is deemed to be the generating formatting object of the last glyph-area preceding the inserted glyph-area in the pre-order traversal of the area tree.

The value of the returned-by trait is a set of pairs, where each pair consists of a formatting object and a positive integer. The integer represents the position of the area in the ordering of all areas returned by the formatting object.

A formatting object is defined to return the sequence of areas, , , ... if the pair (,1) is a member of the returned-by trait of , the pair (,2) is a member of the returned-by trait of , the pair (,3) is a member of the returned-by trait of , ...

If an area is a member of the sequence of areas returned by a formatting object, then either it was generated by the formatting object or it was a member of the sequence of areas returned by a child of that formatting object. Not all areas returned by a child of a formatting object need be returned by that formatting object. A formatting object may generate an area that has, as some of its children areas, areas returned by the children of that formatting object. These children (in the area tree) of the generated area are not returned by the formatting object to which they were returned.

A set of nodes in a tree is a lineage if:

  • there is a node in the set such that all the nodes in the set are ancestors of , and

  • for every node in the set, if the set contains an ancestor of , it also contains the parent of .

The set of formatting objects that an area is returned by is a lineage.

Areas returned by a formatting object may be either normal or out-of-line. Normal areas represent areas in the "normal flow of text"; that is, they become area children of the areas generated by the formatting object to which they are returned. Normal areas have a returned-by lineage of size one. There is only one kind of normal area.

Out-of-line areas are areas used outside the normal flow of text either because they are absolutely positioned or they are part of a float or footnote. Out-of-line areas may have a returned-by lineage of size greater than one.

The area-class trait indicates which class, normal or out-of-line, an area belongs to. For out-of-line areas, it also indicates the subclass of out-of-line area. The values for this trait are: "xsl-normal", "xsl-absolute", "xsl-footnote", "xsl-side-float", or "xsl-before-float". An area is normal if and only if the value of the area-class trait is "xsl-normal"; otherwise, the area is an out-of-line area. (See section [4.2.5 Stacking Constraints].)

The areas returned-by a given formatting object are ordered as noted above. This ordering defines an ordering on the sub-sequence of areas that are of a given area-class, such as the sub-sequence of normal areas. An area precedes an area in the sub-sequence if and only if area precedes area in the areas returned-by the formatting objects.

A reference-area chain is defined as a sequence of reference-areas that is either generated by the same formatting object that is not a page-sequence formatting object, or that consists of the region reference-areas or normal-flow-reference-areas (see [6.4.13 fo:region-body]) generated using region formatting objects assigned to the same flow (see [6.4.1.4 Flows and Flow Mapping]). The reference-areas in the sequence are said to be "contained" by the reference-area chain, and they have the same ordering relative to each other in the sequence as they have in the area tree, using pre-order traversal order of the area tree.

6.2 Formatting Object Content

The content of a formatting object is described using XML content-model syntax. In some cases additional constraints, not expressible in XML content models, are given in prose.

The parameter entity, "%block;" in the content models below, contains the following formatting objects:

block block-container table-and-caption table list-block

The parameter entity, "%inline;" in the content models below, contains the following formatting objects:

bidi-override character external-graphic instream-foreign-object inline inline-container leader page-number page-number-citation basic-link multi-toggle

The following formatting objects are "neutral" containers and may be used, provided that the additional constraints listed under each formatting object are satisfied, anywhere where #PCDATA, %block;, or %inline; are allowed:

multi-switch multi-properties wrapper retrieve-marker

The following "out-of-line" formatting objects may be used anywhere where #PCDATA, %block;, or %inline; are allowed (except as a descendant of any "out-of-line" formatting object):

float

The following "out-of-line" formatting objects may be used anywhere where #PCDATA or %inline; are allowed (except as a descendant of any "out-of-line" formatting object):

footnote

6.3 Formatting Objects Summary

basic-link

The fo:basic-link is used for representing the start resource of a simple link.

bidi-override

The fo:bidi-override inline formatting object is used where it is necessary to override the default Unicode-bidirectional-algorithm direction for different (or nested) inline scripts in mixed-language documents.

block

The fo:block formatting object is commonly used for formatting paragraphs, titles, headlines, figure and table captions, etc.

block-container

The fo:block-container flow object is used to generate a block-level reference-area.

character

The fo:character flow object represents a character that is mapped to a glyph for presentation.

color-profile

Used to declare a color profile for a stylesheet.

conditional-page-master-reference

The fo:conditional-page-master-reference is used to identify a page-master that is to be used when the conditions on its use are satisfied.

declarations

Used to group global declarations for a stylesheet.

external-graphic

The fo:external-graphic flow object is used for a graphic where the graphics data resides outside of the XML result tree in the fo namespace.

float

The fo:float serves two purposes. It can be used so that during the normal placement of content, some related content is formatted into a separate area at beginning of the page (or of some following page) where it is available to be read without immediately intruding on the reader. Alternatively, it can be used when an area is intended to float to one side, with normal content flowing alongside.

flow

The content of the fo:flow formatting object is a sequence of flow objects that provides the flowing text content that is distributed into pages.

footnote

The fo:footnote is used to produce a footnote citation and the corresponding footnote.

footnote-body

The fo:footnote-body is used to generate the content of the footnote.

initial-property-set

The fo:initial-property-set specifies formatting properties for the first line of an fo:block.

inline

The fo:inline formatting object is commonly used for formatting a portion of text with a background or enclosing it in a border.

inline-container

The fo:inline-container flow object is used to generate an inline reference-area.

instream-foreign-object

The fo:instream-foreign-object flow object is used for an inline graphic or other "generic" object where the object data resides as descendants of the fo:instream-foreign-object.

layout-master-set

The fo:layout-master-set is a wrapper around all masters used in the document.

leader

The fo:leader formatting object is used to generate leaders consisting either of a rule or of a row of a repeating character or cyclically repeating pattern of characters that may be used for connecting two text formatting objects.

list-block

The fo:list-block flow object is used to format a list.

list-item

The fo:list-item formatting object contains the label and the body of an item in a list.

list-item-body

The fo:list-item-body formatting object contains the content of the body of a list-item.

list-item-label

The fo:list-item-label formatting object contains the content of the label of a list-item; typically used to either enumerate, identify, or adorn the list-item's body.

marker

The fo:marker is used in conjunction with fo:retrieve-marker to produce running headers or footers.

multi-case

The fo:multi-case is used to contain (within an fo:multi-switch) each alternative sub-tree of formatting objects among which the parent fo:multi-switch will choose one to show and will hide the rest.

multi-properties

The fo:multi-properties is used to switch between two or more property sets that are associated with a given portion of content.

multi-property-set

The fo:multi-property-set is used to specify an alternative set of formatting properties that, dependent on a User Agent state, are applied to the content.

multi-switch

The fo:multi-switch wraps the specification of alternative sub-trees of formatting objects (each sub-tree being within an fo:multi-case), and controls the switching (activated via fo:multi-toggle) from one alternative to another.

multi-toggle

The fo:multi-toggle is used within an fo:multi-case to switch to another fo:multi-case.

page-number

The fo:page-number formatting object is used to represent the current page-number.

page-number-citation

The fo:page-number-citation is used to reference the page-number for the page containing the first normal area returned by the cited formatting object.

page-sequence

The fo:page-sequence formatting object is used to specify how to create a (sub-)sequence of pages within a document; for example, a chapter of a report. The content of these pages comes from flow children of the fo:page-sequence.

page-sequence-master

The fo:page-sequence-master specifies sequences of page-masters that are used when generating a sequence of pages.

region-after

This region defines a viewport that is located on the "after" side of fo:region-body region.

region-before

This region defines a viewport that is located on the "before" side of fo:region-body region.

region-body

This region specifies a viewport/reference pair that is located in the "center" of the fo:simple-page-master.

region-end

This region defines a viewport that is located on the "end" side of fo:region-body region.

region-start

This region defines a viewport that is located on the "start" side of fo:region-body region.

repeatable-page-master-alternatives

An fo:repeatable-page-master-alternatives specifies a sub-sequence consisting of repeated instances of a set of alternative page-masters. The number of repetitions may be bounded or potentially unbounded.

repeatable-page-master-reference

An fo:repeatable-page-master-reference specifies a sub-sequence consisting of repeated instances of a single page-master. The number of repetitions may be bounded or potentially unbounded.

retrieve-marker

The fo:retrieve-marker is used in conjunction with fo:marker to produce running headers or footers.

root

The fo:root node is the top node of an XSL result tree. This tree is composed of formatting objects.

simple-page-master

The fo:simple-page-master is used in the generation of pages and specifies the geometry of the page. The page may be subdivided into up to five regions.

single-page-master-reference

An fo:single-page-master-reference specifies a sub-sequence consisting of a single instance of a single page-master.

static-content

The fo:static-content formatting object holds a sequence or a tree of formatting objects that is to be presented in a single region or repeated in like-named regions on one or more pages in the page-sequence. Its common use is for repeating or running headers and footers.

table

The fo:table flow object is used for formatting the tabular material of a table.

table-and-caption

The fo:table-and-caption flow object is used for formatting a table together with its caption.

table-body

The fo:table-body formatting object is used to contain the content of the table body.

table-caption

The fo:table-caption formatting object is used to contain block-level formatting objects containing the caption for the table only when using the fo:table-and-caption.

table-cell

The fo:table-cell formatting object is used to group content to be placed in a table cell.

table-column

The fo:table-column formatting object specifies characteristics applicable to table cells that have the same column and span.

table-footer

The fo:table-footer formatting object is used to contain the content of the table footer.

table-header

The fo:table-header formatting object is used to contain the content of the table header.

table-row

The fo:table-row formatting object is used to group table-cells into rows.

title

The fo:title formatting object is used to associate a title with a given page-sequence. This title may be used by an interactive User Agent to identify the pages. For example, the content of the fo:title can be formatted and displayed in a "title" window or in a "tool tip".

wrapper

The fo:wrapper formatting object is used to specify inherited properties for a group of formatting objects. It has no additional formatting semantics.

6.4 Declarations and Pagination and Layout Formatting Objects

6.4.1 Introduction

The root node of the formatting object tree must be an fo:root formatting object. The children of the fo:root formatting object are a single fo:layout-master-set, an optional fo:declarations, and a sequence of one or more fo:page-sequences. The fo:layout-master-set defines the geometry and sequencing of the pages; the children of the fo:page-sequences, which are called flows (contained in fo:flow and fo:static-content), provide the content that is distributed into the pages. The fo:declarations object is a wrapper for formatting objects whose content is to be used as a resource to the formatting process. The process of generating the pages is done automatically by the XSL processor formatting the result tree.

The children of the fo:layout-master-set are the pagination and layout specifications. The names of these specifications end in "-master". There are two types of pagination and layout specifications: page-masters and page-sequence-masters. Page-masters have the role of describing the intended subdivisions of a page and the geometry of these subdivisions. Page-sequence-masters have the role of describing the sequence of page-masters that will be used to generate pages during the formatting of an fo:page-sequence.

6.4.1.1 Page-sequence-masters

Each fo:page-sequence-master characterizes a set of possible sequences of page-masters. For any given fo:page-sequence, only one of the possible set of sequences will be used. The sequence that is used is any sequence that satisfies the constraints determined by the individual page-masters, the flows which generate pages from the page-masters, and the fo:page-sequence-master itself.

The fo:page-sequence-master is used to determine which page-masters are used and in which order. The children of the fo:page-sequence-master are a sequence of sub-sequence specifications. The page-masters in a sub-sequence may be specified by a reference to a single page-master or as a repetition of one or more page-masters. For example, a sequence might begin with several explicit page-masters and continue with a repetition of some other page-master (or masters).

The fo:single-page-master-reference is used to specify a sub-sequence consisting of a single page-master.

There are two ways to specify a sub-sequence that is a repetition. The fo:repeatable-page-master-reference specifies a repetition of a single page-master. The fo:repeatable-page-master-alternatives specifies the repetition of a set of page-masters. Which of the alternative page-masters is used at a given point in the sub-sequence is conditional and may depend on whether the page number is odd or even, is the first page, is the last page, or is blank. The "maximum-repeats" property on the repetition specification controls the number of repetitions. If this property is not specified, there is no limit on the number of repetitions.

6.4.1.2 Page-masters

A page-master is a master that is used to generate a page. A page is a viewport/reference pair in which the viewport-area is a child of the area tree root. A page-viewport-area is defined to be the viewport-area of a page, and a page-area is defined to be the unique child of a page-viewport-area.

The page-viewport-area is defined by the output medium; the page-area holds the page contents and has the effect of positioning the page contents on the output medium.

A single page-master may be used multiple times. Each time it is used it generates a single page; for example, a page-master that is referenced from an fo:repeatable-page-master-reference will be used by the fo:page-sequence to generate one page for each occurrence of the reference in the specified sub-sequence.

NOTE:

When pages are used with a User Agent such as a Web browser, it is common that the each document has only one page. The viewport used to view the page determines the size of the page. When pages are placed on non-interactive media, such as sheets of paper, pages correspond to one or more of the surfaces of the paper. The size of the paper determines the size of the page.

In this specification, there is only one kind of page-master, the fo:simple-page-master. Future versions of this specification may add additional kinds of page-masters.

An fo:simple-page-master has, as children, specifications for one or more regions.

A region specification is used as a master, the region-master, in generating viewport/reference pair consisting of a region-viewport-area and a region-reference-area. The region-viewport-area is always a child of a page-area generated using the parent of the region-master.

NOTE:

The regions on the page are analogous to "frames" in an HTML document. Typically, at least one of these regions is of indefinite length in one of its dimensions. For languages with a lr-tb (or rl-tb) writing-mode, this region is typically of indefinite length in the top-to-bottom direction. The viewport represents the visible part of the frame. The flow assigned to the region is viewed by scrolling the region reference-area through the viewport.

Each region is defined by a region formatting object. Each region formatting object has a name and a definite position. In addition, the region's height or width is fixed and the other dimension may be either fixed or indefinite. For example, a region that is the body of a Web page may have indefinite height.

The specification of the region determines the size and position of region-viewport-areas generated using the region formatting object. The positioning of the viewport is relative to its page-area parent.

For version 1.0 of this Recommendation, a page-master will consist of up to five regions: "region-body" and four other regions, one on each side of the body. To allow the side regions to correspond to the current writing-mode, these regions are named "region-before" (which corresponds to "header" in the "lr-tb" writing-mode), "region-after" (which corresponds to "footer" in the "lr-tb" writing-mode), "region-start" (which corresponds to a "left-sidebar" in the "lr-tb" writing-mode) and "region-end" (which corresponds to a "right-sidebar" in the "lr-tb" writing-mode). It is expected that a future version of the Recommendation will introduce a mechanism that allows a page-master to contain an arbitrary number of arbitrarily sized and positioned regions.

Some types of region have conditional sub-regions associated with them, and the associated region-reference-areas are divided up by having child areas corresponding to the sub-regions, including a "main-reference-area" for the region. For region-masters to which the column-count property applies, the main-reference-area is further subdivided by having child-areas designated as "span-reference-areas" whose number depends upon the number of spans (i.e. block-areas with span="all") occurring on the page. These in turn are subdivided by having child-areas designated as "normal-flow-reference-areas", whose number depends on the number of columns specified.

6.4.1.3 Page Generation

Pages are generated by the formatter's processing of fo:page-sequences. As noted above, each page is a viewport/reference pair in which the viewport-area is a child of the area tree root. Each page is generated using a page-master to define the region-viewport-areas and region-reference-areas that correspond to the regions specified by that page-master.

Each fo:page-sequence references either an fo:page-sequence-master or a page-master. If the reference is to a page-master, this is interpreted as if it were a reference to an fo:page-sequence-master that repeats the referenced page-master an unbounded number of times. An fo:page-sequence references a page-master if either the fo:page-sequence directly references the page-master via the "master-reference" property or that property references an fo:page-sequence-master that references the page-master.

6.4.1.4 Flows and Flow Mapping

There are two kinds of flows: fo:static-content and fo:flow. An fo:static-content flow holds content, such as the text that goes into headers and footers, that is repeated on many of the pages. The fo:flow flow holds content that is distributed across a sequence of pages. The processing of the fo:flow flow is what determines how many pages are generated to hold the fo:page-sequence. The fo:page-sequence-master is used as the generator of the sequence of page-masters into which the flow children content is distributed.

The children of a flow are a sequence of block-level flow objects. Each flow has a name that is given by its "flow-name" property. No two flows may have the same name.

The assignment of flows to regions on a page-master is determined by a flow-map. The flow-map is an association between the flow children of the fo:page-sequence and regions defined within the page-masters referenced by that fo:page-sequence.

In version 1.0 of this Recommendation, the flow-map is implicit. The "flow-name" property of a flow specifies to which region that flow is assigned. Each region has a "region-name" property. The implicit flow-map assigns a flow to the region that has the same name. In future versions of XSL, the flow-map is expected to become an explicit formatting object.

To avoid requiring users to generate region-names, the regions all have default values for the "region-name" property. The region-body, region-before, region-after, region-start, and region-end have the default names "xsl-region-body", "xsl-region-before", "xsl-region-after", "xsl-region-start", and "xsl-region-end", respectively.

In addition, an fo:static-content formatting object may have a "flow-name" property value of "xsl-before-float-separator" or "xsl-footnote-separator". If a conditional sub-region of the region-body is used to generate a reference-area on a particular page, the fo:static-content whose name corresponds to the conditional sub-region shall be formatted into the reference-area associated with the sub-region, as specified in section [6.10.1.3 Conditional Sub-Regions].

6.4.1.5 Constraints on Page Generation

The areas that are descendants of a page-area are constrained by the page-master used to generate the page-area and the flows that are assigned to the regions specified on the page-master. For fo:flow flows, the areas generated by the descendants of the flow are distributed across the pages in the sequence that were generated using page-masters having the region to which the flow is assigned. For fo:static-content flows, the processing of the flow is repeated for each page generated using a page-master having the region to which the flow is assigned with two exceptions: for a fo:static-content with a flow-name of , the processing is repeated only for those page-reference-areas which have descendant areas with an area-class of , and for a fo:static-content with a flow-name of , the processing is repeated only for those page-reference-areas which have descendant areas with an area-class of .

6.4.1.6 Pagination Tree Structure

The result tree structure is shown below.

   [D]

Tree Representation of the Formatting Objects for Pagination

6.4.2 fo:root

Common Usage:

This is the top node of the formatting object tree. It holds an fo:layout-master-set formatting object (which holds all masters used in the document), an optional fo:declarations, and one or more fo:page-sequence objects. Each fo:page-sequence represents a sequence of pages that result from formatting the content children of the fo:page-sequence.

NOTE:

A document can contain multiple fo:page-sequences. For example, each chapter of a document could be a separate fo:page-sequence; this would allow chapter-specific content, such as the chapter title, to be placed within a header or footer.

Areas:

Page-viewport-areas are returned by the fo:page-sequence children of the fo:root formatting object. The fo:root does not generate any areas.

Constraints:

The children of the root of the area tree consist solely of, and totally of, the page-viewport-areas returned by the fo:page-sequence children of the fo:root. The set of all areas returned by the fo:page-sequence children is properly ordered. (See Section [4.7.1 General Ordering Constraints].)

Contents:

(layout-master-set,declarations?,page-sequence+)

The following properties apply to this formatting object:

6.4.3 fo:declarations

Common Usage:

The fo:declarations formatting object is used to group global declarations for a stylesheet.

Areas:

The fo:declarations formatting object does not generate or return any areas.

Constraints:

None.

Contents:

(color-profile)+

The fo:declarations flow object may have additional child elements in a non-XSL namespace. Their presence does not, however, change the semantics of the XSL namespace objects and properties. The permitted structure of these non-XSL namespace elements is defined for their namespace(s).

6.4.4 fo:color-profile

Common Usage:

The fo:color-profile formatting object is used to declare an ICC Color Profile for a stylesheet. The color-profile is referenced again via the name specified in the "color-profile-name" property.

The color-profile is identified by the URI specified in the "src" property value. This URI may identify an internally recognized color-profile or it may point to a ICC Color Profile encoding that should be loaded and interpreted.

When the color-profile is referenced (e.g., via the rgb-icc function [5.10.2 Color Functions]), the following rules are used:

  1. If the color-profile is available, the color value identified from the color-profile should be used.

  2. If the color-profile is not available, the sRGB ([sRGB]) fallback must be used.

Areas:

The fo:color-profile formatting object does not generate or return any areas.

Constraints:

None.

Contents:

EMPTY

The following properties apply to this formatting object:

6.4.5 fo:page-sequence

Common Usage:

The fo:page-sequence formatting object is used to specify how to create a (sub-)sequence of pages within a document; for example, a chapter of a report. The content of these pages comes from flow children (consisting of the single fo:flow and any fo:static-content flow objects) of the fo:page-sequence. The layout of these pages comes from the fo:page-sequence-master or page-master referenced by the master-reference trait on the fo:page-sequence. The sequence of areas returned by each of the flow-object children of the fo:page-sequence are made descendants of the generated pages as described below.

Areas:

The fo:page-sequence formatting object generates a sequence of viewport/reference pairs, and returns the page-viewport-areas. For each page-reference-area, and each region specified in the page-master used to generate that page-reference-area, the fo:page-sequence object also generates the viewport/reference pair for the occurrence of that region in that page-reference-area, and may generate a before-float-reference-area, footnote-reference-area, and main-reference-area, and one or more normal-sequence-reference-areas. The generation of these further areas is described in the descriptions of the fo:simple-page-master and region-masters. It may also generate a title-area.

All areas generated by an fo:page-sequence have area-class "xsl-absolute".

Constraints:

Each page-viewport-area/page-reference-area pair is generated using a page-master that satisfies the constraints of the page-sequence-master identified by the master-reference trait of the fo:page-sequence or a page-master that was directly identified by the master-reference trait. The region-viewport-area children of such a page-reference-area must correspond to the regions that are children of that page-master.

The areas generated by the fo:page-sequence have as their descendants the areas returned by the flows that are children of the fo:page-sequence.

The areas returned to the fo:page-sequence by a flow must satisfy four types of constraints:

  • Completeness. All areas returned by formatting object descendants of the flow children of the fo:page-sequence become descendants of areas generated by the fo:page-sequence, with the exception of glyph-areas subject to deletion or substitution as in Sections [4.7.2 Line-building] and [4.7.3 Inline-building].

  • Flow-map association. All areas returned by flow children of the fo:page-sequence become descendants of region-reference-areas generated from column-areas associated to the flow by the flow-map in effect, except for areas returned from a fo:static-content with a flow-name of or .

    Areas returned from an fo:static-content with a flow-name of become children of the before-float-reference-area of an area associated to an fo:region-body, following all sibling areas of area-class . Areas returned from an fo:static-content with a flow-name of become children of the footnote-reference-area of an area associated to an fo:region-body, preceding all sibling areas of area-class .

  • Area-class association. Areas returned by flow children of an fo:page-sequence are distributed as follows: all areas of area-class must be descendants of a footnote-reference-area; areas of area-class must be descendants of a before-float-reference-area; all other areas (including normal areas) must be descendants of a main-reference-area for a region.

  • Stacking. The stackable areas of a given class returned by children of each flow are properly stacked within the appropriate reference-area, as described above.

If a title-area is generated the following constraints must be satisfied:

  • Completeness. All areas returned by formatting object descendants of the fo:title child of the fo:page-sequence become descendants of the title-area generated by the fo:page-sequence, with the exception of glyph-areas subject to deletion or substitution as in Sections [4.7.2 Line-building] and [4.7.3 Inline-building].

  • Stacking. The areas returned by children of the fo:title are properly stacked within the title-area.

The default ordering constraint of section [4.7.1 General Ordering Constraints] does not apply to the fo:page-sequence. The default ordering constraints apply to the flow object children inside the single fo:flow; special ordering constraints apply to the child fo:static-content objects.

Contents:

(title?,static-content*,flow)

The following properties apply to this formatting object:

6.4.6 fo:layout-master-set

Common Usage:

The fo:layout-master-set is a wrapper around all masters used in the document. This includes page-sequence-masters, page-masters, and region-masters.

Areas:

The fo:layout-master-set formatting object generates no area directly. The masters that are the children of the fo:layout-master-set are used by the fo:page-sequence to generate pages.

Constraints:

The value of the master-name trait on each child of the fo:layout-master-set must be unique within the set.

Contents:

(simple-page-master|page-sequence-master)+

6.4.7 fo:page-sequence-master

Common Usage:

The fo:page-sequence-master is used to specify the constraints on and the order in which a given set of page-masters will be used in generating a sequence of pages. Pages are automatically generated when the fo:page-sequence-master is used in formatting an fo:page-sequence.

NOTE:

There are several ways of specifying a potential sequence of pages. One can specify a sequence of references to particular page-masters. This yields a bounded sequence of potential pages. Alternatively, one can specify a repeating sub-sequence of one or more page-masters. This sub-sequence can be bounded or unbounded. Finally one can intermix the two kinds of sub-sequence-specifiers.

Areas:

The fo:page-sequence-master formatting object generates no area directly. It is used by the fo:page-sequence formatting object to generate pages.

Constraints:

The children of the fo:page-sequence-master are a sequence of sub-sequence-specifiers. A page-sequence satisfies the constraint determined by an fo:page-sequence-master if (a) it can be partitioned into a sequence of sub-sequences of pages that map one-to-one to an initial sub-sequence of the sequence of sub-sequence-specifiers that are the children of the fo:page-sequence-master and, (b) for each sub-sequence of pages in the partition, that sub-sequence satisfies the constraints of the corresponding sub-sequence-specifier. The sequence of sub-sequences of pages can be shorter than the sequence of sub-sequence-specifiers.

It is an error if the entire sequence of sub-sequence-specifiers children is exhausted while some areas returned by an fo:flow are not placed. Implementations may recover, if possible, by re-using the sub-sequence-specifier that was last used to generate a page.

Contents:

(single-page-master-reference|repeatable-page-master-reference|repeatable-page-master-alternatives)+

The following properties apply to this formatting object:

6.4.8 fo:single-page-master-reference

Common Usage:

An fo:single-page-master-reference is the simplest sub-sequence-specifier. It specifies a sub-sequence consisting of a single instance of a single page-master. It is used to specify the use of a particular page-master at a given point in the sequence of pages that would be generated using the fo:page-sequence-master that is the parent of the fo:single-page-master-reference.

Areas:

The fo:single-page-master-reference formatting object generates no area directly. It is used by the fo:page-sequence formatting object to generate pages.

Constraints:

The fo:single-page-master-reference has a reference to the fo:simple-page-master which has the same master-name as the master-reference trait on the fo:single-page-master-reference.

The sub-sequence of pages mapped to this sub-sequence-specifier satisfies the constraints of this sub-sequence-specifier if (a) the sub-sequence of pages consists of a single page and (b) that page is constrained to have been generated using the fo:simple-page-master referenced by the fo:single-page-master-reference.

Contents:

EMPTY

The following properties apply to this formatting object:

6.4.9 fo:repeatable-page-master-reference

Common Usage:

An fo:repeatable-page-master-reference is the next simplest sub-sequence-specifier. It specifies a sub-sequence consisting of repeated instances of a single page-master. The number of repetitions may be bounded or potentially unbounded.

Areas:

The fo:repeatable-page-master-reference formatting object generates no area directly. It is used by the fo:page-sequence formatting object to generate pages.

Constraints:

The fo:repeatable-page-master-reference has a reference to the fo:simple-page-master which has the same master-name as the master-reference trait on the fo:repeatable-page-master-reference.

The sub-sequence of pages mapped to this sub-sequence-specifier satisfies the constraints of this sub-sequence-specifier if (a) the sub-sequence of pages consists of zero or more pages, (b) each page is generated using the fo:simple-page-master referenced by the fo:repeatable-page-master-reference, and (c) length of the sub-sequence is less than or equal to the value of maximum-repeats.

If no region-master child of the fo:repeatable-page-master has a region-name associated to any flow in an fo:page-sequence, then the sub-sequence is constrained to have length zero.

Contents:

EMPTY

The following properties apply to this formatting object:

6.4.10 fo:repeatable-page-master-alternatives

Common Usage:

The fo:repeatable-page-master-alternatives formatting object is the most complex sub-sequence-specifier. It specifies a sub-sequence consisting of repeated instances of a set of alternative page-masters. The number of repetitions may be bounded or potentially unbounded. Which of the alternative page-masters is used at any point in the sequence depends on the evaluation of a condition on the use of the alternative. Typical conditions include, testing whether the page which is generated using the alternative is the first or last page in a page-sequence or is the page blank. The full set of conditions allows different page-masters to be used for the first page, for odd and even pages, for blank pages.

NOTE:

Because the conditions are tested in order from the beginning of the sequence of children, the last alternative in the sequence usually has a condition that is always true and this alternative references the page-master that is used for all pages that do not receive some specialized layout.

Areas:

The fo:repeatable-page-master-alternatives formatting object generates no area directly. This formatting object is used by the fo:page-sequence formatting object to generate pages.

Constraints:

The children of the fo:repeatable-page-master-alternatives are fo:conditional-page-master-references. These children will be called alternatives.

The sub-sequence of pages mapped to this sub-sequence-specifier satisfies the constraints of this sub-sequence-specifier if (a) the sub-sequence of pages consists of zero or more pages, (b) each page is generated using the fo:simple-page-master referenced by the one of the alternatives that are the children of the fo:repeatable-page-master-alternatives, (c) the conditions on that alternative are , (d) that alternative is the first alternative in the sequence of children for which all the conditions are , and (e) the length of the sub-sequence is less than or equal to the value of maximum-repeats.

Contents:

(conditional-page-master-reference+)

The following properties apply to this formatting object:

6.4.11 fo:conditional-page-master-reference

Common Usage:

The fo:conditional-page-master-reference is used to identify a page-master that is to be used when the conditions on its use are satisfied. This allows different page-masters to be used, for example, for even and odd pages, for the first page in a page-sequence, or for blank pages. This usage is typical in chapters of a book or report where the first page has a different layout than the rest of the chapter and the headings and footings on even and odd pages may be different as well.

Areas:

The fo:conditional-page-master-reference formatting object generates no area directly. It is used by the fo:page-sequence formatting object to generate pages.

Constraints:

The fo:conditional-page-master-reference has a reference to the fo:simple-page-master which has the same master-name as the master-reference trait on the fo:conditional-page-master-reference.

There are three traits, page-position, odd-or-even, and blank-or-not-blank that specify the sub-conditions on the use of the referenced page-master. All three sub-conditions must be for the condition on the fo:conditional-page-master-reference to be . Since the properties from which these traits are derived are not inherited and the initial value of all the properties makes the corresponding sub-condition , this really means that the subset of traits that are derived from properties with specified values must make the corresponding sub-condition .

The sub-condition corresponding to the page-position trait is if the page generated using the fo:conditional-page-master-reference has the specified position in the sequence of pages generated by the referencing page-sequence; namely, "first", "last", "rest" (not first nor last) or "any" (all of the previous). The referencing page-sequence is the fo:page-sequence that referenced the fo:page-sequence-master from which this fo:conditional-page-master-reference is a descendant.

The sub-condition corresponding to the odd-or-even trait is if the value of the odd-or-even trait is "any" or if the value matches the parity of the page number of the page generated using the fo:conditional-page-master-reference.

The sub-condition corresponding to the blank-or-not-blank trait is , if (1) the value of the trait is "not-blank" and the page generated using the fo:conditional-page-master-reference has areas generated by descendants of the fo:flow formatting object; if (2) the value of the trait is "blank" and the page generated using the fo:conditional-page-master-reference is such that there are no areas from the fo:flow to be put on that page (e.g., (a) to maintain proper page parity due to (i) a break-after or break-before value of "even-page" or "odd-page" or (ii) at the start or end of the page-sequence or (b) because the constraints on the areas generated by descendants of the fo:flow formatting object would not be satisfied if they were descendant from this page); or if (3) the value of the trait is "any".

NOTE:

If any page-master referenced from a conditional-page-master-reference with blank-or-not-blank="" provides a region in which to put fo:flow content, no content is put in that region.

Contents:

EMPTY

The following properties apply to this formatting object:

6.4.12 fo:simple-page-master

Common Usage:

The fo:simple-page-master is used in the generation of pages and specifies the geometry of the page. The page may be subdivided into up to five regions: region-body, region-before, region-after, region-start, and region-end.

NOTE:

For example, if the writing-mode of the fo:simple-page-master is "lr-tb", then these regions correspond to the body of a document, the header, the footer, the left sidebar, and the right sidebar.

NOTE:

The simple-page-master is intended for systems that wish to provide a simple page layout facility. Future versions of this Recommendation will support more complex page layouts constructed using the fo:page-master formatting object.

Areas:

The fo:simple-page-master formatting object generates no area directly. It is used in the generation of pages by an fo:page-sequence.

When the fo:simple-page-master is used to generate a page, a viewport/reference pair is generated, consisting of a page-viewport-area and a page-reference-area. The page-viewport-area represents the physical bounds of the output medium. The page-reference-area represents the portion of the page on which content is intended to appear; that is, the area inside the page margins.

In addition, when the fo:simple-page-master is used to generate a page, viewport/reference pairs that correspond to the regions that are the children of the fo:simple-page-master are also generated. (See the formatting object specifications for the five regions ([6.4.13 fo:region-body], [6.4.14 fo:region-before], [6.4.15 fo:region-after], [6.4.16 fo:region-start], and [6.4.17 fo:region-end]) for the details on the generation of these areas.)

   [D]

Region-viewport-areas

The spacing between the outer four regions and the fo:region-body is determined by subtracting the relevant extent trait on each outer region from the "margin-x" property on the fo:region-body.

Trait Derivation:

In version 1.0 of this Recommendation, borders and padding are not allowed with a page-reference-area. The remaining traits on the page-reference-area are set according to normal rules for determining the values of traits.

Constraints:

When a page-master is used in the generation of a page, the block-progression-dimension and inline-progression-dimension of the content-rectangle of the page-viewport-area are determined using the computed values of the "page-height" and "page-width" properties.

The traits derived from the margin properties determine the size and position of the content-rectangle of the page-viewport-area. The traits derived from the "margin-top", "margin-bottom", "margin-left" and "margin-right" properties are used to indent the page-reference-area content-rectangle from the corresponding edge of the content-rectangle of the page-viewport-area. Here "top", "bottom", "left" and "right" are determined by the computed values of the "page-height" and "page-width" properties. For sheet media, these values determine the orientation of the sheet; "page-height" is measured from "top" to "bottom". For display media, the display window is always upright; the top of the display screen is "top".

NOTE:

The reference points for the page-viewport-area content-rectangle are in terms of the "top", "bottom", "left", and "right" rather than "before-edge", "after-edge", "start-edge", and "end-edge" because users see the media relative to its orientation and not relative to the writing-mode currently in use.

   [D]

The value of the page-number trait on the first page returned by the fo:page-sequence is constrained to equal the value of the initial-page-number trait. The value of the page-number trait on subsequent pages is constrained to be one greater than the value on the immediately preceding page.

The format, letter-value, grouping-separator, grouping-size, country, and language traits are used to format the number into a string form, as specified in XSLT, section 7.7.1. This formatted number is used as the value of the fo:page-number flow object.

Constraints applicable to regions:

There are a number of constraints that apply to all the regions that are specified within a given fo:simple-page-master.

   [D]

If the block-progression-dimension of the properly stacked region-reference-area is greater than the block-progression-dimension of the region-viewport-area that is its parent, then the constraints on the relationship between the region-viewport-area and the region-reference-area depend on values of the overflow trait on the region-master and the kind of flow assigned to the region.

If the flow assigned to the corresponding region is an fo:static-content flow object, then there is no constraint on the block-progression-dimension of the region-reference-area.

If the flow assigned to the corresponding region is an fo:flow formatting object, then

  • If the value of the media-usage trait is , or the value of the overflow trait is , , or , then the block-progression-dimension of the region-reference-area is constrained to be no greater than the block-progression-dimension of the region-viewport-area.

  • If the value of the media-usage trait is or , and the value of the overflow trait is or , then there is no constraint on the block-progression-dimension of the region-reference-area.

Contents:

(region-body,region-before?,region-after?,region-start?,region-end?)

The following properties apply to this formatting object:

6.4.13 fo:region-body

Common Usage:

Used in constructing a simple-page-master. This region specifies a viewport/reference pair that is located in the "center" of the fo:simple-page-master. The overflow trait controls how much of the underlying region-reference-area is visible; that is, whether the region-reference-area is clipped by its parent region-viewport-area.

NOTE:

Typically, for paged media, the areas returned by the fo:flow formatting object in a fo:page-sequence are made to be descendants of a sequence of region-reference-areas that correspond to the region-body. These region-reference-areas are all area descendants of page-areas for which the page-master included an fo:region-body. If the fo:flow flow is assigned to some other region, then the areas returned by the fo:flow are constrained to be descendants of region-reference-areas generated using the assigned region-master.

NOTE:

The body region should be sized and positioned within the fo:simple-page-master so that there is room for the areas returned by the flow that is assigned to the fo:region-body and for any desired side regions, that is, fo:region-before, fo:region-after, fo:region-start and fo:region-end's that are to be placed on the same page. These side regions are positioned within the content-rectangle of the page-reference-area. The margins on the fo:region-body are used to position the region-viewport-area for the fo:region-body and to leave space for the other regions that surround the fo:region-body.

   [D]

The spacing between the last four regions and the fo:region-body is determined by subtracting the relevant extent trait on the side regions from the trait that corresponds to the "margin-" property on the fo:region-body.

The fo:region-body may be also be used to provide multiple columns. When the column-count trait is greater than one, then the region-body will be subdivided into multiple columns.

Areas:

The fo:region-body formatting object is used to generate one region-viewport-area and one region-reference-area whenever an fo:simple-page-master that has an fo:region-body as a child is used to generate a page. A scrolling mechanism shall be provided, in an implementation-defined manner, if the value of the overflow trait is "scroll".

The position and size of the region-viewport-area is specified relative to the content-rectangle of the page-reference-area generated by fo:simple-page-master. The content-rectangle of the region-viewport-area is indented from the content-rectangle of the page-reference-area by the values of the "margin-top", "margin-bottom", "margin-left" and "margin-right" properties. In version 1.0 of this Recommendation, the values of the padding and border-width traits must be "0".

The region-reference-area generated using an fo:region-body is the child of the region-viewport-area. The reference-orientation trait of the fo:region-body is used to orient the coordinate system of the region-reference-area generated by the fo:region-body relative to the coordinate system of the page-reference-area generated by fo:simple-page-master (and, therefore, relative to the viewport positioned in that latter coordinate system).

In addition to the viewport/reference pair, when the region-body is used to generate areas, at least one and up to three additional reference-areas are generated. These reference-areas are the optional before-float-reference-area, the optional footnote-reference-area, and the main-reference-area. The latter reference-area comprises the space left after space is borrowed for the other two reference-areas. The main-reference-area has no padding, border, or space associated with it.

NOTE:

If there is no before-float-reference-area or footnote-reference-area child of the region-reference-area, then the content-rectangle of the main-reference-area is coterminous with the content-rectangle of the region-reference-area.

The main-reference-area has as its children a sequence of span-reference-areas. These are reference-area block-areas with zero border and padding, whose inline-progression-dimension is equal to that of the main-reference-area, and which are normally stacked within the main-reference-area.

Each span-reference-area has one or more reference-area children, designated as normal-flow-reference-areas. The number and placement of the children of a span-reference-area depends on the column-count trait of the span-reference-area. In turn, the formatter must generate precisely enough of these span-reference-areas, and so set their column-count traits, that block-areas returned from the fo:flow with a span of "all" are children of span-reference-areas with column-count equal to 1, and block-areas returned from the fo:flow with a span of "none" are children of span-reference-areas with column-count equal to the refined value of the column-count property of the associated region-reference-area.

For each span-reference-area, the number of normal-flow-reference-area children is equal to the value of the column-count trait.

It is an error to specify a column-count other than 1 if the "overflow" property has the value "scroll". An implementation may recover by behaving as if "1" had been specified.

The inline-progression-dimension of each of these normal-flow-reference-areas is determined by subtracting (-1) times the column-gap trait from the inline-progression-dimension of the main-reference-area and dividing that result by . Using "body-in-size" for the name of the inline-progression-dimension of the span-reference-area and "column-in-size" for the name of the size of the normal-flow-reference-areas in the inline-progression-direction, the formula is:

column-in-size = (body-in-size - ( - 1)*column-gap)/

The block-progression-dimension of the normal-flow-reference-areas is the same as that of the parent span-reference-area.

NOTE:

As noted above, the block-progression-dimension of the span-reference-area may be less than the size of the region-reference-area if a before-float-reference-area or footnote-reference-area are present, or if there is more than one span-reference-area child of the main-reference-area.

The normal-flow-reference-areas are positioned within the span-reference-area as follows: The first column is positioned with the before-edge and start-edge of its content-rectangle coincident with the before-edge and start-edge of the content-rectangle of the span-reference-area. The content-rectangle of the th normal-flow-reference-area child of the span-reference-area is positioned with its before-edge coincident with the before-edge of the content-rectangle of the span-reference-area and with is start-edge at ((-1)*(column-in-size + column-gap)) in the inline-progression-direction. This results in the end-edge of the content-rectangle of the th normal-flow-reference-area being coincident with the end-edge of the content-rectangle of the span-reference-area.

NOTE:

If the writing-mode is "rl-tb", the above description means that the columns are ordered from right-to-left as would be expected. This follows because the start-edge is on the right in an "rl-tb" writing-mode.

All areas generated by using the fo:region-body are of area-class "xsl-absolute".

Trait Derivation:

The reference-orientation of the region-viewport-area is taken from the value of the reference-orientation trait on the region-master which specifies the region. reference-orientation of the region-reference-area is set to "0" and is, therefore, the same as the orientation established by the region-viewport-area.

The remaining traits on the region-viewport-area and region-reference-area are set according to normal rules for determining the values of traits.

The traits on the span-reference-areas and on the normal-flow-reference-areas are determined, in the same manner as described in [5 Property Refinement / Resolution], from a set of properties where each property has its initial value except for reference-orientation, writing-mode, and display-align that have the value from the fo:region-body.

Constraints:

The constraints applicable to all regions (see [6.4.12 fo:simple-page-master]) all apply.

The inline-progression-dimension of the region-viewport-area is determined by the inline-progression-dimension of the content-rectangle of the page-reference-area minus the values of the start-indent and end-indent traits of the region-master. The start-edge and end-edge of the content-rectangle of the region-viewport-area are determined by the reference-orientation trait on the page-master.

The block-progression-dimension of the region-viewport-area is determined by the block-progression-dimension of the content-rectangle for the page-reference-area minus the values of the space-before and space-after traits of the region-master. The before-edge and after-edge of the content-rectangle of the region-viewport-area are determined by the reference-orientation trait on the page-master.

The values of the space-before and start-indent traits are used to position the region-viewport-area relative to the before-edge and start-edge of the content-rectangle of the page-reference-area.

The constraints on the size and position of the region-reference-area generated using the fo:region-body are covered in the "Constraints applicable to regions" section of [6.4.12 fo:simple-page-master].

Contents:

EMPTY

The following properties apply to this formatting object:

6.4.14 fo:region-before

Common Usage:

Used in constructing a simple-page-master. This region specifies a viewport/reference pair that is located on the "before" side of the page-reference-area. In lr-tb writing-mode, this region corresponds to the header region. The overflow trait controls how much of the underlying region-reference-area is visible; that is, whether the region-reference-area is clipped by its parent region-viewport-area.

Areas:

The fo:region-before formatting object is used to generate one region-viewport-area and one region-reference-area.

In version 1.0 of this Recommendation, the values of the padding and border-width traits must be "0".

The before-edge of the content-rectangle of this region-viewport-area is positioned coincident with the before-edge of the content-rectangle of the page-reference-area generated using the parent fo:simple-page-master. The block-progression-dimension of the region-viewport-area is determined by the extent trait on the fo:region-before formatting object.

The inline-progression-dimension of the region-viewport-area is determined by the precedence trait on the fo:region-before. If the value of the precedence trait is , then the inline-progression-dimension extends up to the start-edge and end-edge of the content-rectangle of the page-reference-area. In this case, the region-before region-viewport-area acts like a float into areas generated by the region-start and region-end. If the value of the precedence trait on the fo:region-before is , then these adjacent regions float into the area generated by the fo:region-before and the extent of the fo:region-before is (effectively) reduced by the incursions of the adjacent regions.

The region-reference-area lies on a canvas underneath the region-viewport-area. The reference-orientation trait is used to orient the coordinate system of the region-reference-area relative to the page-reference-area.

The size of the region-reference-area depends on the setting of the overflow trait on the region. If the value of that trait is "auto", "hidden", "error-if-overflow", "paginate", or "visible" then the size of the reference-area is the same as the size of the viewport. If the value of the overflow trait is "scroll", the size of the reference-area is equal to the size of the viewport in the inline-progression-direction in the writing-mode for the region and has no constraint in the block-progression-direction (which implies that it grows to hold the distribution of all the content bound to the region).

Trait Derivation:

The reference-orientation of the region-viewport-area is taken from the value of the reference-orientation trait on the region-master which specifies the region. reference-orientation of the region-reference-area is set to "0" and is, therefore, the same as the orientation established by the region-viewport-area.

The remaining traits on the region-viewport-area and region-reference-area are set according to normal rules for determining the values of traits.

Constraints:

The constraints on the size and position of the region-reference-area generated using the fo:region-before are covered in the "Constraints applicable to regions" section of [6.4.12 fo:simple-page-master].

Contents:

EMPTY

The following properties apply to this formatting object:

6.4.15 fo:region-after

Common Usage:

Used in constructing a simple-page-master. This region specifies a viewport/reference pair that is located on the "after" side of the page-reference-area. In lr-tb writing-mode, this region corresponds to the footer region. The overflow trait controls how much of the underlying region-reference-area is visible; that is, whether the region-reference-area is clipped by its parent region-viewport-area.

Areas:

The fo:region-after formatting object is used to generate one region-viewport-area and one region-reference-area.

In version 1.0 of this Recommendation, the values of the padding and border-width traits must be "0".

The after-edge of the content-rectangle of this region-viewport-area is positioned coincident with the after-edge of the content-rectangle of the page-reference-area generated using the parent fo:simple-page-master. The block-progression-dimension of the region-viewport-area is determined by the extent trait on the fo:region-after formatting object.

The inline-progression-dimension of the region-viewport-area is determined by the precedence trait on the fo:region-after. If the value of the precedence trait is , then the inline-progression-dimension extends up to the start-edge and end-edge of the content-rectangle of the page-reference-area. In this case, the region-after region-viewport-area acts like a float into areas generated by the region-start and region-end. If the value of the precedence trait on the fo:region-after is , then these adjacent regions float into the area generated by the fo:region-after and the extent of the fo:region-after is (effectively) reduced by the incursions of the adjacent regions.

The region-reference-area lies on a canvas underneath the region-viewport-area. The reference-orientation trait is used to orient the coordinate system of the region-reference-area relative to the page-reference-area.

The size of the region-reference-area depends on the setting of the overflow trait on the region. If the value of that trait is "auto", "hidden", "error-if-overflow", "paginate", or "visible" then the size of the reference-area is the same as the size of the viewport. If the value of the overflow trait is "scroll", the size of the reference-area is equal to the size of the viewport in the inline-progression-direction in the writing-mode for the region and has no constraint in block-progression-direction (which implies that it grows to hold the distribution of all the content bound to the region).

Trait Derivation:

The reference-orientation of the region-viewport-area is taken from the value of the reference-orientation trait on the region-master which specifies the region. reference-orientation of the region-reference-area is set to "0" and is, therefore, the same as the orientation established by the region-viewport-area.

The remaining traits on the region-viewport-area and region-reference-area are set according to normal rules for determining the values of traits.

Constraints:

The constraints on the size and position of the region-reference-area generated using the fo:region-after are covered in the "Constraints applicable to regions" section of [6.4.12 fo:simple-page-master].

Contents:

EMPTY

The following properties apply to this formatting object:

6.4.16 fo:region-start

Common Usage:

Used in constructing a simple-page-master. This region specifies a viewport/reference pair that is located on the "start" side of the page-reference-area. In lr-tb writing-mode, this region corresponds to a left sidebar. The overflow trait controls how much of the underlying region-reference-area is visible; that is, whether the region-reference-area is clipped by its parent region-viewport-area.

Areas:

The fo:region-start formatting object is used to generate one region-viewport-area and one region-reference-area.

In version 1.0 of this Recommendation, the values of the padding and border-width traits must be "0".

The start-edge of the content-rectangle of this region-viewport-area is positioned coincident with the start-edge of the content-rectangle of the page-reference-area generated using the parent fo:simple-page-master. The inline-progression-dimension of the region-viewport-area is determined by the extent trait on the fo:region-after formatting object.

The block-progression-dimension of the region-viewport-area is determined by the precedence trait on the adjacent fo:region-before and the fo:region-after, if these exist; otherwise it is determined as if the value of the precedence trait was . If the value of the precedence trait of the fo:region-before (or, respectively, fo:region-after) is , then the block-progression-dimension extends up to the before- (or, respectively, after-) edge of the content-rectangle of the page-reference-area. In this case, the region-start acts like a float into areas generated by the region-before (respectively, the region-after). If the value of the precedence trait on the adjacent regions is , then these adjacent regions float into the area generated by the fo:region-start and the extent of the fo:region-start is (effectively) reduced by the incursions of the adjacent regions with the value of the precedence trait equal to .

The region-reference-area lies on a canvas underneath the region-viewport-area. The reference-orientation trait is used to orient the coordinate system of the region-reference-area relative to the page-reference-area.

The size of the region-reference-area depends on the setting of the overflow trait on the region. If the value of that trait is "auto", "hidden", "error-if-overflow", "paginate", or "visible" then the size of the reference-area is the same as the size of the viewport. If the value of the overflow trait is "scroll", the size of the reference-area is equal to the size of the viewport in the inline-progression-direction in the writing-mode for the region and has no constraint in block-progression-direction (which implies that it grows to hold the distribution of all the content bound to the region).

Trait Derivation:

The reference-orientation of the region-viewport-area is taken from the value of the reference-orientation trait on the region-master which specifies the region. reference-orientation of the region-reference-area is set to "0" and is, therefore, the same as the orientation established by the region-viewport-area.

The remaining traits on the region-viewport-area and region-reference-area are set according to normal rules for determining the values of traits.

Constraints:

The constraints on the size and position of the region-reference-area generated using the fo:region-start are covered in the "Constraints applicable to regions" section of [6.4.12 fo:simple-page-master].

Contents:

EMPTY

The following properties apply to this formatting object:

6.4.17 fo:region-end

Common Usage:

Used in constructing a simple-page-master. This region specifies a viewport/reference pair that is located on the "end" side of the page-reference-area. In lr-tb writing-mode, this region corresponds to a right sidebar. The overflow trait controls how much of the underlying region-reference-area is visible; that is, whether the region-reference-area is clipped by its parent region-viewport-area.

Areas:

The fo:region-end formatting object is used to generate one region-viewport-area and one region-reference-area.

In version 1.0 of this Recommendation, the values of the padding and border-width traits must be "0".

The end-edge of the content-rectangle of this region-viewport-area is positioned coincident with the end-edge of the content-rectangle of the page-reference-area generated using the parent fo:simple-page-master. The inline-progression-dimension of the region-viewport-area is determined by the extent trait on the fo:region-after formatting object.

The block-progression-dimension of the region-viewport-area is determined by the precedence trait on the adjacent fo:region-before and the fo:region-after, if these exist; otherwise it is determined as if the value of the precedence trait was . If the value of the precedence trait of the fo:region-before (or, respectively, fo:region-after) is , then the block-progression-dimension extends up to the before- (or, respectively, after-) edge of the content-rectangle of the page-reference-area. In this case, the region-end acts like a float into areas generated by the region-before (respectively, the region-after). If the value of the precedence trait on the adjacent regions is , then these adjacent regions float into the area generated by the fo:region-end and the extent of the fo:region-end is (effectively) reduced by the incursions of the adjacent regions with the value of the precedence trait equal to .

The region-reference-area lies on a canvas underneath the region-viewport-area. The reference-orientation trait is used to orient the coordinate system of the region-reference-area relative to the page-reference-area.

The size of the region-reference-area depends on the setting of the overflow trait on the region. If the value of that trait is "auto", "hidden", "error-if-overflow", "paginate", or "visible" then the size of the reference-area is the same as the size of the viewport. If the value of the overflow trait is "scroll", the size of the reference-area is equal to the size of the viewport in the inline-progression-direction in the writing-mode for the region and has no constraint in block-progression-direction (which implies that it grows to hold the distribution of all the content bound to the region).

Trait Derivation:

The reference-orientation of the region-viewport-area is taken from the value of the reference-orientation trait on the region-master which specifies the region. reference-orientation of the region-reference-area is set to "0" and is, therefore, the same as the orientation established by the region-viewport-area.

The remaining traits on the region-viewport-area and region-reference-area are set according to normal rules for determining the values of traits.

Constraints:

The constraints on the size and position of the region-reference-area generated using the fo:region-end are covered in the "Constraints applicable to regions" section of [6.4.12 fo:simple-page-master].

Contents:

EMPTY

The following properties apply to this formatting object:

6.4.18 fo:flow

Common Usage:

The content of the fo:flow formatting object is a sequence of flow objects that provides the flowing text content that is distributed into pages.

Areas:

The fo:flow formatting object does not generate any areas. The fo:flow formatting object returns a sequence of areas created by concatenating the sequences of areas returned by each of the children of the fo:flow. The order of concatenation is the same order as the children are ordered under the fo:flow.

Constraints:

The (implicit) flow-map determines the assignment of the content of the fo:flow to a region.

Contents:

(%block;)+

In addition this formatting object may have a sequence of zero or more fo:markers as its initial children.

The following properties apply to this formatting object:

6.4.19 fo:static-content

Common Usage:

The fo:static-content formatting object holds a sequence or a tree of formatting objects that is to be presented in a single region or repeated in like-named regions on one or more pages in the page-sequence. Its common use is for repeating or running headers and footers.

This content is repeated, in its entirety, on every page to which it is assigned.

Areas:

The fo:static-content formatting object does not generate any areas. The fo:static-content formatting object returns the sequence of areas created by concatenating the sequences of areas returned by each of the children of the fo:static-content. The order of concatenation is the same order as the children are ordered under the fo:static-content.

Constraints:

The (implicit) flow-map determines the assignment of the content of the fo:static-content to a region.

The fo:static-content may be processed multiple times and thus the default ordering constraint of section [4.7.1 General Ordering Constraints] does not apply to the fo:static-content. Instead, it must satisfy the constraint on a per-page basis. Specifically, if is a page-reference-area, is an area-class, and is the set of all descendants of of area-class returned to the fo:static-content descendant, then must be properly-ordered.

Contents:

(%block;)+

The following properties apply to this formatting object:

6.4.20 fo:title

Common Usage:

The fo:title formatting object is used to associate a title with a given page-sequence. This title may be used by an interactive User Agent to identify the pages. For example, the content of the fo:title can be formatted and displayed in a "title" window or in a "tool tip".

Areas:

This formatting object returns the sequence of areas returned by the children of this formatting object.

Constraints:

The sequence of returned areas must be the concatenation of the sub-sequences of areas returned by each of the flow children of the fo:title formatting object in the order in which the children occur.

Contents:

(#PCDATA|%inline;)*

An fo:title is not permitted to have an fo:float, fo:footnote or fo:marker as a descendant.

Additionally, an fo:title is not permitted to have as a descendant an fo:block-container that generates an absolutely positioned area.

The following properties apply to this formatting object:

XSL Formatting Objects

The XSL technology is also composed of XSL Formatting Objects (XSL-FO). XSL-FO was designed to assist with the printing and displaying of XML data. The main emphasis is on the document layout and structure. This includes the dimensions of the output doc-ument, including page headers, footers, and margins. XSL-FO also allows the developer to define the formatting rules for the content, such as font, style, color, and positioning. XSL-FO is a sophisticated version of Cascading Style Sheets (CSS). In fact, XSL-FO borrows a lot of the terminology and elements from CSS.

XSL-FO documents are well-formed XML documents. An XSL-FO formatting engine processes XSL-FO documents. You can use two techniques for creating XSL-FO docu-ments. The first is to simply develop the XSL-FO file with the included data. The second technique is to dynamically create the XSL-FO file using an XSLT translation.

XSL-FO Formatting Engines

The current W3C Candidate Recommendation for XSL-FO is 15 October 2001 and is available at http://www.w3.org/TR/2001/REC-xsl-20011015. Many of the XSL-FO formatting engines implement a subset of the XSL-FO specification. Also, the browser support for XSL-FO is nonexistent.

However, don’t be discouraged. Engines are available that allow you to experiment with the basic features of XSL-FO. In fact, we’ll use the Apache XSL-FOP to generate PDF documents from XML. Table 9.2 contains a list of XSL-FO formatting engines.

The source code distribution for this chapter includes the Apache XSL-FO formatting engine. You have everything you need to run the examples. You can download additional engines if you’d like to experiment with them.

TABLE 9.2     XSL-FO Formatting Engines


The examples in this chapter are based Apache XSL-FOP version 0.20.1.


In this section, we will create a simple XSL-FO document. Once the document is cre-ated, we will use the Apache XSL-FOP formatter to convert the document to a PDF file. The application interaction is illustrated in Figure 9.14.


Basic Document Structure

An XML-FO document follows the syntax rules of XML; as a result, it is well formed. XSL-FO elements use the following namespace:

http://www.w3.org/1999/XSL/Format

The following code snippet shows the basic document setup for XSL-FO:

<?xml  version=”1.0”  encoding=”utf-8”?>

<fo:root xmlns:fo=”http://www.w3.org/1999/XSL/Format”> <!-- layout master set -->

<!-- page  masters:  size  and  layout  -->

<!-- page sequences and content --> </fo:root>

The element <fo:root> is the root element for the XSL-FO document. An XSL-FO doc-ument can contain the following components:

   Page master

   Page master set

   Page sequences

Page Master: <fo:page-master>

The page master describes the page size and layout. For example, we could use an 8.5× 11-inch page or an A4 letter. The page master contains the dimensions for a page, including width, height, and margins. The page master is similar to a slide master in Microsoft PowerPoint. The components of the page master are shown in Figure 9.15.

The <fo:simple-page-master> element defines the layout of a page. The following code snippet describes a U.S. letter:

<fo:simple-page-master master-name=”simple” page-height=”11in” page-width=”8.5in” margin-top=”1in” margin-bottom=”1in” margin-left=”1.25in” margin-right=”1.25in”>

</fo:simple-page-master>


Notice the attributes for <fo:simple-page-master>. The attributes define the height and width of the page, along with the size of the margins. The dimensions in this example are listed in inches (in). Table 9.3 lists the dimensions supported in XSL-FO.

TABLE 9.3     XSL-FO Dimensions


Unit Suffix      : Description

           

in         Inches (1 inch equals 2.54 centimeters)

mm      Millimeters

cm       Centimeters

pt         Points (1 point equals 1/72 inch)

pc        Picas (1 pica equals 12 points)

em       Font size of the relevant font

ex        X-height of the relevant font

px        Pixels

To set the page height to 210 millimeters, use the following syntax:

page-height=”210mm”

The <fo:simple-page-master> element can also be used to describe an A4 letter (height 210 mm and width 297 mm):

<fo:simple-page-master master-name=”A4-example” page-height=”210mm” page-width=”297mm” margin-top=”0.5in” margin-bottom=”0.5in” margin-left=”0.5in” margin-right=”0.5in”>

</fo:simple-page-master>

Each page is divided into five regions. Regions serve as containers for the document con-tent. The regions are depicted below in Figure 9.16.


The region-before and region-after areas are commonly used for page headers and footers. The region-body area is the center of the page and contains the main content. The region-start and region-end sections are commonly used for left and right side-bars, respectively. During the definition of a page master, you specify the size of the regions using the following elements:

   <fo:region-before>

   <fo:region-after>

   <fo:region-body>

   <fo:region-start>

   <fo:region-end>

The following example defines the dimensions for <fo:region-body>, <fo:region-

before>, and <fo:region-after>:

<fo:simple-page-master master-name=”simple” page-height=”11in” page-width=”8.5in”>

<fo:region-body margin-top=”0.5in”/> <fo:region-before extent=”0.5in”/> <fo:region-after extent=”0.5in”/>

</fo:simple-page-master>

The extent attribute has a different meaning, depending on the region. For <fo:region-end> and <fo:region-start>, the extent attribute specifies the width. For <fo:region-before> and <fo:region-after>, it specifies the height.

Page Master Set: <fo:page-master-set>

A document can be composed of multiple pages, each with its own dimensions. The page master set refers to the collection of page masters.

In the following code example, a page master set is defined that contains one page set:

<fo:layout-master-set>

<fo:simple-page-master master-name=”simple” page-height=”11in” page-width=”8.5in” margin-top=”1in” margin-bottom=”1in” margin-left=”1.25in” margin-right=”1.25in”>

<fo:region-body margin-top=”0.5in”/> <fo:region-before extent=”3cm”/> <fo:region-after extent=”1.5cm”/>

</fo:simple-page-master> </fo:layout-master-set>

Let’s integrate the new elements into the basic document structure. Recall from earlier in this section that an XSL-FO document has the following structure:

<?xml  version=”1.0”  encoding=”utf-8”?>

<fo:root xmlns:fo=”http://www.w3.org/1999/XSL/Format”> <!-- layout master set -->

<!-- page  masters:  size  and  layout  -->

<!-- page sequences and content --> </fo:root>

With the information provided thus far, we can fill in the blanks for the page master set. The following code example contains a page master set with a simple page master:

<?xml  version=”1.0”  encoding=”utf-8”?>

<fo:root xmlns:fo=”http://www.w3.org/1999/XSL/Format”> <!-- layout master set -->

<fo:layout-master-set>

<!-- page masters: size and layout --> <fo:simple-page-master master-name=”simple”

page-height=”11in” page-width=”8.5in” margin-top=”1in” margin-bottom=”1in” margin-left=”1.25in” margin-right=”1.25in”>

<fo:region-body margin-top=”0.5in”/> <fo:region-before extent=”3cm”/> <fo:region-after extent=”1.5cm”/>

</fo:simple-page-master>

</fo:layout-master-set>

<!-- page sequences and content --> </fo:root>

Now that we have the page layout defined, we can start adding content with page sequences.

Page Sequences: <fo:page-sequence>

A page sequence defines a series of printed pages. Each page sequence refers to a page master for its dimensions. The page sequence contains the actual content for the document.

The <fo:page-sequence> element contains <fo:static-content> and <fo:flow> ele-ments.

The <fo:static-content> element is used for page headers and footers. For example, we can define a header for the company name and page number, and this information will appear on every page.

The <fo:flow> element contains a collection of text blocks. The <fo:flow> element is similar to a collection of paragraphs. A body of text is defined using the <fo:block> ele-ment. The <fo:block> element is a child element of <fo:flow>. The <fo:block> ele-ment contains free-flowing text that will wrap to the next line in a document if it overflows.

In this example, we’ll use the <fo:flow> and <fo:block> elements to create a document for a fictional company, Ez Books Online. The desired output for the document as a PDF is shown in Figure 9.17.

The following code fragment defines a page sequence. This sequence uses the simple page master we defined earlier in this section. Also, the <fo:flow> element contains two <fo:block> elements. Here’s the code:

<fo:page-sequence  master-name=”simple”>

<fo:flow  flow-name=”xsl-region-body”>

<!-- this defines a level 1 heading with orange background --> <fo:block font-size=”18pt”

font-family=”sans-serif” line-height=”24pt” space-after.optimum=”15pt” background-color=”orange” color=”white” text-align=”center” padding-top=”3pt”>

Ez Books Online </fo:block>

<!-- Paragraph that contains info about the company --> <fo:block font-size=”12pt”

font-family=”sans-serif” line-height=”15pt” space-after.optimum=”14pt” text-align=”justify”>

Welcome to Ez Books Online, the world’s smallest online book store. Our company’s mission is to sell books on Java, Thrillers and Romance. We have something for everyone...so we think. Feel free to browse our catalog and if you find a book of interest then send us an e-mail. Thanks for visiting!

</fo:block>

</fo:flow> </fo:page-sequence>

The <fo:flow> element has to specify a region for its content. In this example, the content is placed in the main body region.

The first <fo:block> element defines a heading with an orange background. Notice how the content of each <fo:block> can be customized using font and line attributes.

The second <fo:block> element contains information about the company. The text for <fo:block> is free flowing. The text will automatically wrap. Ample space is provided at the end of the paragraph using the space-after.optimum attribute.

Now let’s integrate the new elements into the basic document structure. Recall from earlier that an XSL-FO document has the following structure:

<?xml  version=”1.0”  encoding=”utf-8”?>

<fo:root xmlns:fo=”http://www.w3.org/1999/XSL/Format”> <!-- layout master set -->

<!-- page  masters:  size  and  layout  -->

<!-- page sequences and content --> </fo:root>

Listing 9.15 contains the additional code for the page sequence.

LISTING 9.15  <install_dir>\ch9_xsl\xsl_fo\simple.fo

<?xml  version=”1.0”  encoding=”utf-8”?>

<fo:root xmlns:fo=”http://www.w3.org/1999/XSL/Format”> <!-- layout master set -->

<fo:layout-master-set>

<!-- page masters: size and layout --> <fo:simple-page-master master-name=”simple”

page-height=”11in” page-width=”8.5in” margin-top=”1in” margin-bottom=”1in” margin-left=”1.25in” margin-right=”1.25in”>

<fo:region-body margin-top=”0.5in”/> <fo:region-before extent=”3cm”/> <fo:region-after extent=”1.5cm”/>

</fo:simple-page-master>

</fo:layout-master-set>

<!-- page sequences and content --> <fo:page-sequence master-name=”simple”>

<fo:flow flow-name=”xsl-region-body”>

<!-- this defines a level 1 heading with orange background --> <fo:block font-size=”18pt”

font-family=”sans-serif” line-height=”24pt” space-after.optimum=”15pt” background-color=”orange” color=”white” text-align=”center” padding-top=”3pt”>

Ez Books Online </fo:block>

<!-- Paragraph that contains info about the company --> <fo:block font-size=”12pt”

font-family=”sans-serif” line-height=”15pt” space-after.optimum=”14pt” text-align=”justify”>

Welcome to Ez Books Online, the world’s smallest online book store. Our company’s mission is to sell books on Java, Thrillers and Romance. We have something for everyone...so we think. Feel free to browse our catalog and if you find a book of interest then send us an e-mail. Thanks for visiting!

</fo:block>

</fo:flow> </fo:page-sequence>

</fo:root>

Generating a PDF Document

Now that we have the XSL-FO document simple.fo, let’s convert it to a PDF file. In this chapter, we are using the open-source Apache-FOP formatting engine. It is included in the source code download for this chapter. Apache-FOP requires the Java Development Kit from Sun Microsystems. The Adobe Acrobat Reader is required to view the PDF docu-ments. The Acrobat Reader is freely available at http://www.adobe.com.

Follow these steps to generate a PDF document from simple.fo:

     Open an MS-DOS window.

     Move to the directory <install_dir>\ch9_xsl\xsl_fo\.

     Set up the Java classpath by typing setpaths.

Execute Apache-FOP by typing fop  simple.fo  simple.pdf.

The Apache-FOP formatter now reads the input file simple.fo and generates the output file simple.pdf.

     View the simple.pdf file in Adobe Acrobat Reader. Your screen should resemble what’s shown in Figure 9.17.

Page Headers and Footers

The <fo:static-content> element defines content that should appear on every page. The <fo:static-content> element is commonly used to set up page headers and footers. The <fo:static-content> element is a component of <fo:page-sequence>.

In this example, we’ll define a page header that contains the company name and current page number. We’ll also define a footer that lists the company’s Web site. This example is also composed of multiple pages to illustrate the fact that the header and footer are repeated on each page.

The header is defined using the following code fragment:

<!-- header  

0 comments

Leave a Reply

Your email address will not be published. Required fields are marked *