XSL-FO Blocks
XSL-FO output resides in block areas.
XSL-FO Pages, Flows, and Blocks
Content "blocks" "flow" into "pages", and are then output to the medium.
XSL-FO output is usually nested in fo:block elements,fo:block nested in fo:flow elements,fo:flow nested in fo:page-sequence elements:
Properties of block areas
A block is a sequence of output located in a rectangular box:
This block of output will have a one millimeter border around it.
Since block areas are rectangular boxes, they share many common area properties:
- space before and space after
- margin
- border
- padding
space before and space after are the whitespace that separates blocks.
margin is the blank area outside the block.
border is the rectangle at the outer edge of the area. Each of its four sides can have a different width. It can also be filled with different colors and background images.
padding is the area located between the border and content regions.
content An area can contain actual content, such as text, images, graphics, etc.
Block Margin
- margin
- margin-top
- margin-bottom
- margin-left
- margin-right
Block Border
Border style properties:
- border-style
- border-before-style
- border-after-style
- border-start-style
- border-end-style
- border-top-style (equivalent to border-before)
- border-bottom-style (equivalent to border-after)
- border-left-style (equivalent to border-start)
- border-right-style (equivalent to border-end)
Border color properties:
- border-color
- border-before-color
- border-after-color
- border-start-color
- border-end-color
- border-top-color (equivalent to border-before)
- border-bottom-color (equivalent to border-after)
- border-left-color (equivalent to border-start)
- border-right-color (equivalent to border-end)
Border width properties:
- border-width
- border-before-width
- border-after-width
- border-start-width
- border-end-width
- border-top-width (equivalent to border-before)
- border-bottom-width (equivalent to border-after)
- border-left-width (equivalent to border-start)
- border-right-width (equivalent to border-end)
Block Padding
- padding
- padding-before
- padding-after
- padding-start
- padding-end
- padding-top (equivalent to padding-before)
- padding-bottom (equivalent to padding-after)
- padding-left (equivalent to padding-start)
- padding-right (equivalent to padding-end)
Block Background
- background-color
- background-image
- background-repeat
- background-attachment (scroll or fixed)
Block Styling Attributes
A block is a sequence of output that can be styled individually:
This block of output will be written in a 12pt sans-serif font.
Font properties:
- font-family
- font-weight
- font-style
- font-size
- font-variant
Text properties:
- text-align
- text-align-last
- text-indent
- start-indent
- end-indent
- wrap-option (defines automatic line wrapping)
- break-before (defines a page break)
- break-after (defines a page break)
- reference-orientation (defines text rotation in 90" increments)
Example
space-before="5mm" space-after="5mm"> RUNOOB
At RUNOOB you will find all the Web-building tutorials you
need, from basic HTML and XHTML to advanced XML, XSL, Multimedia and WAP.
Result:
|
RUNOOB At RUNOOB you will find all the Web-building tutorials you need, from basic HTML and XHTML to advanced XML, XSL, Multimedia and WAP. |
|---|
Looking at the example above, generating a document with many headings and paragraphs would require a great deal of code.
Usually, XSL-FO documents do not combine formatting information and content the way we just did.
With a little help from XSLT, we can put formatting information into templates and then write cleaner content.
In later chapters of this tutorial, you will learn how to use XSLT templates to compose XSL-FO.