XSL-FO Block
XSL-FO output is located in block areas.
XSL-FO Page, Flow, and Block
Content "blocks" flow into "pages" and then output to the medium.
XSL-FO output is typically nested within the <fo:block>
element, which is nested within the <fo:flow>
element, which is nested within the <fo:page-sequence>
element:
Block Area Properties
Blocks are output sequences contained within rectangular boxes:
Since block areas are rectangular boxes, they can share many common area properties:
- space before and space after
- margin
- border
- padding
Space before and space after are the spaces that separate 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 different widths. It can also be filled with different colors and background images.
Padding is the area between the border and the content area.
Content 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
Blocks are output sequences that can be styled individually:
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 page break)
- break-after (defines page break)
- reference-orientation (defines text rotation in 90° increments)
Example
Result:
| tutorialpro At tutorialpro you will find all the Web-building <br> tutorials you need, from basic HTML and XHTML to advanced XML, XSL, Multimedia and WAP. |
Please look at the example above, if you want to create a document with many headings and paragraphs, it will require a lot of code.
Usually, XSL-FO documents do not combine formatting information and content as we did just now.
With a little help from XSLT, we can put the formatting information into templates and write cleaner content.
You will learn how to use XSLT templates to combine XSL-FO in the later sections of this tutorial.