Definitive XSL-FO

4.4.1 Simple page layout definition

Every different page layout to be rendered must be described separately.

  • simple-page-master :

    • must be named using the master- name property.

  • It can be used to specify differences in reference orientations of regions .

  • It can be used to specify differences in column progression directions.

    • Changes from defaults are specified by explicitly setting the writing-mode property.

  • It can be used to specify differences in geometry, including

    • page dimensions,

    • region dimensions.

A page's page viewport area's content rectangle defines the page dimensions.

  • The page's page reference area's content rectangle is within page margin boundaries.

  • The body region's region viewport area is the page reference area's content rectangle.

Every page layout has at least a "middle" body region (see Figure 4-2).

  • region-body :

    • may be named differently than the default " xsl-region-body " name;

      • typically, it is explicitly named to distinguish regions in sequenced pages;

      • where the same name is used on more than one page master, all uses of the name must be for the same kind of region,

    • is distinct from optional perimeter regions in definition but not in page area.

Perimeter regions cut into the body region.

  • They may be named differently from the default names using region-name .

    • Renaming regions promotes good maintenance practice.

    • region-before is named " xsl-region-before " by default.

    • region-after is named " xsl-region-after " by default.

    • region-start is named " xsl-region-start " by default.

    • region-end is named " xsl-region-end " by default.

  • If the body region doesn't have margins, then the perimeter region content will overlap the body content.

    • Perimeter regions do not automatically shrink the size of the content rectangle of the body region.

  • Before and after regions can indicate they have precedence over the start and end regions.

Regions may have different reference orientations and writing modes.

  • A common need to have a landscape body region orientation inside of a portrait page geometry with portrait before and after regions.

There are important region name constraints on multiple page masters.

  • Once a given custom name is used, it must be used for the same region position wherever else it is used on other page masters.

  • The reserved names cannot be used by regions other than those that already use them per the Recommendation.

  • For example, the region name " myheader ", when used for a region-before , can only be used for a region-before in other page masters.

4.4.2 Spans and columns in simple page geometry

Hierarchy of reference areas within page includes spans and columns.

  • Body region contains main reference area;

    • this area occupies the entire region width;

    • it sits between before-float reference area and footnote reference area.

  • main reference area contains span reference areas;

    • these are groups of columns with the same number of columns spanned ;

    • groups are stacked in the block-progression direction.

  • span reference area contains normal-flow reference areas (columns);

    • the normally-flowed blocks of information in the flow are flowed into the columns;

    • columns are stacked in the inline-progression direction.

Only evenly- spaced columns are allowed.

  • Only the column count and column gap can be specified;

  • the fixed column specification applies to entire page;

    • you cannot change column count within a page, other than by spanning all columns.

Only main reference area wide spans are allowed.

  • A block can span all columns or only one column.

Columns are balanced within each span reference area.

  • A given span reference area accepts blocks in its normal-flow reference areas, until the number of columns spanned by a block changes;

    • a new span reference area is then introduced on the page;

    • all blocks flowed in the interrupted span reference area are re-flowed across all columns;

    • the balancing depends not on the count of blocks, but on the content of each block and the contained lines.

  • All blocks flowed into the last span reference area of the main reference area are balanced across all columns.

Consider a before/after situation of a formatter flowing a mixture of spanned and un-spanned blocks shown in the two sides of Figure 4-11.

  • Six un-spanned blocks flow into a normal-flow reference area as normal blocks;

  • a seventh block spans all columns and triggers the generation of a new span reference area;

  • the content of the first six blocks is flowed across all normal-flow reference areas of the first span reference area based on the length of the content in the sum total of the six blocks.

    • The count of blocks is irrelevant;

    • the total length of all blocks is balanced across the columns while accommodating keeps, widows, and orphans.

Figure 4-11. Hierarchy of span areas

4.4.3 The simple-page-master object

Purpose

  • This is the specification of a given page's physical geometry.

Content

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

  • child objects (listed alphabetically ):

    • region-after ( 6.4.15 ; 197),

    • region-before ( 6.4.14 ; 195),

    • region-body ( 6.4.13 ; 114),

    • region-end ( 6.4.17 ; 199),

    • region-start ( 6.4.16 ; 198),

  • referring object:

    • layout-master-set ( 6.4.6 ; 65).

Property sets

  • Common margin properties block ( 7.10 ; 332).

Other required property

  • master-name ( 7.25.8 ; 393).

Other optional properties

  • page-height ( 7.25.13 ; 402),

  • page-width ( 7.25.15 ; 403),

  • reference-orientation ( 7.20.3 ; 407),

  • writing-mode ( 7.27.7 ; 429).

Shorthand influencing the above properties

  • size ( 7.29.21 ; 413).

The use of the XSL-FO page description element is shown in Example 4-2.

4.4.4 The region-body object

Purpose

  • This is the definition of the middle area inside all perimeter regions defined for the page.

Example 4-2 The use of the XSL-FO page description element

Line 01 <?xml version="1.0" encoding="utf-8"?> 02 <root xmlns="http://www.w3.org/1999/XSL/Format" font-size="16pt"> 03 <layout-master-set> 04 <simple-page-master master-name="bookpage" 05 page-height="297mm" page-width="210mm" 06 margin-top="15mm" margin-bottom="15mm" 07 margin-left="15mm" margin-right="15mm"> 08 <region-body region-name="bookpage-body" 09 margin-top="5mm" margin-bottom="5mm"/> 10 </simple-page-master> 11 </layout-master-set> 12 <page-sequence master-reference="bookpage"> 13 <title>Hello world example</title> 14 <flow flow-name="bookpage-body"> 15 <block>Hello XSL-FO!</block> 16 </flow> 17 </page-sequence> 18 </root>

Content

  • ( 6.4.13 ) EMPTY ,

  • referring object:

    • simple-page-master ( 6.4.12 ; 114).

Property sets

  • Common border, padding, and background properties ( 7.7 ; 328),

  • common margin properties block ( 7.10 ; 332).

Other required property

  • region-name ( 7.25.17 ; 407).

Other optional properties

  • clip ( 7.20.1 ; 368),

  • column-count ( 7.25.2 ; 369)

  • column-gap ( 7.25.3 ; 369),

  • display-align ( 7.13.4 ; 373),

  • overflow ( 7.20.2 ; 397),

  • reference-orientation ( 7.20.3 ; 407),

  • writing-mode ( 7.27.7 ; 429).

Properties of note

  • The region-name property is required, but the default name of " xsl-region-body " is used as this required property if a name is not supplied in the XSL-FO instance.

  • Even though padding and border-width properties are indicated as available indirectly through the common property set, these values are fixed at " 0pt " in XSL-FO 1.0.

  • display-align is used to keep the information in the region snug against the before edge, snug against the after edge, or centered in the middle of the two in the block-progression direction.

The page body description element is shown in Example 4-3.

Example 4-3 The page body description element

Line 01 <?xml version="1.0" encoding="utf-8"?> 02 <root xmlns="http://www.w3.org/1999/XSL/Format" font-size="16pt"> 03 <layout-master-set> 04 <simple-page-master master-name="bookpage" 05 page-height="297mm" page-width="210mm" 06 margin-top="15mm" margin-bottom="15mm" 07 margin-left="15mm" margin-right="15mm"> 08 <region-body region-name="bookpage-body" 09 margin-top="5mm" margin-bottom="5mm"/> 10 </simple-page-master> 11 </layout-master-set> 12 <page-sequence master-reference="bookpage"> 13 <title>Hello world example</title> 14 <flow flow-name="bookpage-body"> 15 <block>Hello XSL-FO!</block> 16 </flow> 17 </page-sequence> 18 </root>

4.4.5 Page sequence titling

A sequence of pages can be assigned a title

  • presented to the user by the formatter in an implementation dependent fashion;

    • the formatter may choose to render the title on the result canvas, e.g.:

      • once per page sequence,

      • once per page;

    • an interactive user agent could display the title in the title bar of a screen window;

    • the title may be suppressed altogether by the formatter.

This is a portability issue with respect to development.

  • A stylesheet writer may be using a formatter that presents the title information outside of the page canvas.

  • The user of a stylesheet may be using a formatter that presents the title information on the page canvas.

    • The result may not be as desired by the stylesheet writer.

4.4.6 The title object

Purpose

  • This is a page sequence's ancillary description not rendered on the page canvas.

Content

  • ( 6.4.20 ) (#PCDATA %inline;)* ,

  • child object:

    • %inline; ( 6.2 ; 70),

  • referring object:

    • page-sequence ( 6.4.5 ; 65).

  • This object must not have a marker or out-of-line descendant, i.e.:

    • marker ,

    • float ,

    • footnote ,

    • block-container with an absolute position specification.

Property sets

  • Common accessibility properties ( 7.4 ; 326),

  • common aural properties ( 7.6 ; 327),

  • common border, padding, and background properties ( 7.7 ; 328),

  • common font properties ( 7.8 ; 331),

  • common margin properties inline ( 7.11 ; 333).

Other optional properties

  • color ( 7.17.1 ; 369),

  • line-height ( 7.15.4 ; 390),

  • visibility ( 7.28.8 ; 425).

Shorthand influencing the above properties

  • font ( 7.29.13 ; 377).

The XSL-FO page body description element is shown in Example 4-4.

Example 4-4 The XSL-FO page body description element

Line 01 <?xml version="1.0" encoding="utf-8"?> 02 <root xmlns="http://www.w3.org/1999/XSL/Format" font-size="16pt"> 03 <layout-master-set> 04 <simple-page-master master-name="bookpage" 05 page-height="297mm" page-width="210mm" 06 margin-top="15mm" margin-bottom="15mm" 07 margin-left="15mm" margin-right="15mm"> 08 <region-body region-name="bookpage-body" 09 margin-top="5mm" margin-bottom="5mm"/> 10 </simple-page-master> 11 </layout-master-set> 12 <page-sequence master-reference="bookpage"> 13 <title>Hello world example</title> 14 <flow flow-name="bookpage-body"> 15 <block>Hello XSL-FO!</block> 16 </flow> 17 </page-sequence> 18 </root>

Категории