May 28, 2021 XSL-FO
2. XSL-FO page (Page), Flow, and Block
3. The property of the block area
The XSL-FO block is used to store the output.
The output of XSL-FO is in the block area.
The content "block" will "stream" into the page and then output to the media.
XSL-FO outputs are usually nested within the elements of the .lt;fo:block>
<fo:page-sequence>
<fo:flow flow-name="xsl-region-body">
<fo:block>
<!-- Output goes here -->
</fo:block>
</fo:flow>
</fo:page-sequence>
A block is an output sequence that is located in a rectangular box:
<fo:block border-width="1mm">
This block of output will have a one millimeter border around it.
</fo:block>
Because block areas are rectangular boxes, many common area properties can be shared:
Space before and space after are gaps that split between blocks.
Margin is a blank area on the outside of the block.
Border is a rectangle at the outer edge of the area. A ll 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 areas can contain actual content, such as text, pictures, graphics, and so on.
Border style properties:
Border color properties:
Border width properties:
Blocks are output sequences that can be styled individually:
<fo:block font-size="12pt" font-family="sans-serif">
This block of output will be written in a 12pt sans-serif font.
</fo:block>
Font properties:
Text properties:
<fo:block font-size="14pt" font-family="verdana" color="red"
space-before="5mm" space-after="5mm">
W3CSchool
</fo:block>
<fo:block text-indent="5mm" font-family="verdana" font-size="12pt">
At W3CSchool you will find all the Web-building tutorials you
need, from basic HTML and XHTML to advanced XML, XSL, Multimedia and WAP.
</fo:block>
Results:
W3CSchool At W3CSchool you will find all the Web-building tutorials you need, from basic HTML and XHTML to advanced XML, XSL, Multimedia and WAP. |
Look at the example above, if you want to generate a document with many headings and paragraphs, you'll need a lot of code.
Typically, XSL-FO documents do not combine formatted information and content as we just did.
With a little help from XSLT, we can put formatted information into templates and write something purer.
You'll learn how to combine XSL-FO using XSLT templates later in this tutorial.