XSL-FO block area.

The <fo:block> is the child <fo:flow> element. It is used for formatting paragraphs, titles, headlines, figure and table captions, etc. The <fo:block> element may have the following attributes:

  • space-before and space-after
  • margin attributes
  • border attributes (border style, color, width)
  • padding
  • background attributes
  • text attributes

Here is a simple example:

  <?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="Page" page-width="21cm" page-height="29cm">
              <fo:region-body region-name="body" margin-top="3cm" margin-bottom="3cm" 
			  margin-left="3cm" margin-right="2cm"/>
          </fo:simple-page-master>
      </fo:layout-master-set>
      <fo:page-sequence master-reference="Page">
          <fo:flow flow-name="body" font-family="Times" font-size="12pt"> 
              <fo:block text-align="justify" space-after="6pt" border="0.5pt solid black">
                  The first paragraph of a document. The space after the paragraph is 6 pt.
				  The text is justified, it has black border. 
		      </fo:block>
              <fo:block text-align="left" space-before="12pt">
                 The second paragraph. The text has left allignment and has no borders. 
				 The space before the paragraph is 12 pt.
              </fo:block>
          </fo:flow>
      </fo:page-sequence>
  </fo:root>