The block is one of the key concepts of XSL-FO. The block is used to insert all possible elements, such as tables, images, lists, paragraphs and so on, in rectangular display areas. These blocks can be nested in one another in any order to bundle several blocks of one level.
By stringing together the blocks, the page or column is filled. Blocks which, as a whole, do not fit into the page or column are divided between the pages according to the given break rules.
By using appropriate attributes, layout information of all kinds can be linked to the <fo:block> element. These include information about the fonts, font sizes, borders, indents, colours, background colours and images, hyphenation etc. to be used. It should be noted that most of these attributes are inheritable. This means that they do not necessarily have to be added to the block which contains directly the content to be set, but that they are already specified for elements which are superordinated to the given block in the stylesheet.
In the following example various compositions of <fo:block> are presented, but the variety of possible compositions is only presented to a very limited extent.
<?xml version="1.0" encoding="UTF-8"?> <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"> <fo:layout-master-set> <fo:simple-page-master master-name="HelloWorld"> <fo:region-body/> </fo:simple-page-master> </fo:layout-master-set> <fo:page-sequence master-reference="HelloWorld"> <fo:flow flow-name="xsl-region-body"> <fo:block font-family="Arial" font-size="18pt"> (1) 1. Hallo Welt!!! <!-- en: Hello World!!! --> </fo:block> <fo:block margin-left="10mm" font-family="Arial" font-size="18pt"> (2) 2. Hallo Welt!!! </fo:block> <fo:block background-color="blue" font-family="Arial" font-size="18pt"> (3) 3. Hallo Welt!!! </fo:block> <fo:block margin-left="10mm" margin-top="20mm" font-family="Times New Roman" font-size="24pt"> (4) 4. Hallo Welt!!! </fo:block> <fo:block font-weight="bold" font-style="italic" font-family="Arial" font-size="18pt"> (5) 5. Hallo Welt!!! </fo:block> <fo:block border-style="solid" border-width="2pt" margin-left="10mm" margin-right="10mm" font-family="Arial" font-size="18pt"> (6) 6. Hallo Welt!!! </fo:block> </fo:flow> </fo:page-sequence> </fo:root>
(1) The attributes font-family and font-size indicate the font family and the font size.
(2) Here, a left indent is set from the block margin: margin-left. Such indents or spaces can also be set on the top, bottom and right: margin-top, margin-bottom and margin-right.
(3) There is a huge number of attributes for the definition of colours in order to determine the background colour, as you can see in the example, as well as to generate coloured frames or fonts. Background colours always fill out the entire block. So the dimensions of the block can be made visible.
(4) Here, the application of indents (horizontal) and feeds (vertical) and another font is demonstrated.
(5) The attributes font-weight and font-style determine the font style (bold, italic, in combination bold-italic).
(6) Blocks can be provided with borders. The four border parts are also seperately determinable regarding style as well as colour and width. Here the border-style attribute determines a border in the form of a continuous line and border-width determines its width. It should be noted that the border surrounds the given block, so it lies beyond the block boundaries.
The valid attributes for the <fo:block> element are organised under the themes listed below. Further notes concerning functionality, attribute values and inheritance characteristics can be found in the reference part. The attributes (characteristics) being important in practice and their functional features are outlined below.
background-attachment, background-color, background-image, background-repeat, background-position-horizontal, background-position-vertical
For borders (beyond the block boundaries):
border-before-color, border-before-style, border-before-width, border-after-color, border-after-style, border-after-width, border-start-color, border-start-style, border-start-width, border-end-color, border-end-style, border-end-width, border-top-color, border-top-style, border-top-width, border-bottom-color, border-bottom-style, border-bottom-width, border-left-color, border-left-style, border-left-width, border-right-color, border-right-style, border-right-width
For fonts and font styles:
font-model, font-family, font-selection-strategy, font-size, font-stretch, font-size-adjust, font-style, font-variant, font-weight
country, hyphenate, hyphenation-character, hyphenation-push-character-count, hyphenation-remain-character-count, hyphenation-keep, hyphenation-ladder-count, language
For line and page breaks:
break-after, break-before, keep-together, keep-with-next, keep-with-previous
For fillings and margins (within the block boundaries):
margin-top, margin-bottom, margin-left, margin-right, padding-before, padding-after, padding-start, padding-end, padding-top, padding-bottom, padding-left, padding-rightpause-after, space-before, space-after
color, end-indent, id, intrusion-displace, last-line-end-indent, linefeed-treatment, line-height, line-height-shift-adjustment, line-stacking-strategy, orphans, relative-position, richness, role, script, source-document, span, start-indent, text-align, text-align-last, text-altitude, text-depth, text-indent, visibility, white-space-collapse, white-space-treatment, widows, wrap-option
|<< back||next >>|
Copyright © dpunkt.verlag GmbH 2004
Printing of the online version is permitted exclusively for private use. Otherwise this chapter from the book "XSL-FO in der Praxis" ("XSL-FO in practice") is subject to the same provisions as those applicable for the hardcover edition: The work including all its components is protected by copyright. All rights reserved, including reproduction, translation, microfilming as well as storage and processing in electronic systems.
dpunkt.verlag GmbH, Ringstraße 19B, 69115 Heidelberg, fon 06221-14830, fax 06221-148399, email@example.com