Xml-Fo: Presented by Nikhil
Xml-Fo: Presented by Nikhil
Presented by Nikhil
XML-FO
What is XML-FO ??
in one line
- the formatting of XML data for output to screen, paper or other media.
- Styling is both about transforming and formatting information.
XSL-FO Documents
- XSL-FO documents are stored in files with a .fo or a .fob file extension.
- You can also store XSL-FO documents with an .xml extension (to make them more accessible to
XML editors).
Structure Explained.
..continue
The <fo:root> element is the root element of XSL-FO documents. The root element also declares the
namespace for XSL-FO:
Each <fo:simple-page-master> element contains a single page template. Each template must have a
unique name (master-name):
One or more <fo:page-sequence> elements describe the page contents. The master-reference attribute
refers to the simple-page-master template with the same name:
XSL-FO Areas
XSL-FO uses rectangular boxes (areas) to display output.
The XSL formatting model defines a number of rectangular areas (boxes) to display output.
All output (text, pictures, etc.) will be formatted into these boxes and then displayed or printed to a target
media.
Pages
Regions
Block areas
Line areas
Inline areas
XSL-FO Pages
XSL-FO output is formatted into pages. Printed output will normally go into many separate pages. Browser
output will often go into one long page.
XSL-FO Regions
Each XSL-FO Page contains a number of Regions:
..continue
XSL-FO Block Areas
- XSL-FO Block areas define small block elements (the ones that normally starts with a new
line) like paragraphs, tables and lists.
- XSL-FO Block areas can contain other Block areas, but most often they contain Line areas.
XSL-FO Output
XSL-FO defines output inside <fo:flow> elements.
XSL-FO Page, Flow, and Block
- "Blocks" of content "Flows" into "Pages" and then to the output media.
- XSL-FO output is normally nested inside <fo:block> elements, nested inside
<fo:flow> elements, nested inside <fo:page-sequence> elements:
XSL-FO Example
XSL-FO Flow
Output ---
XSL-FO Flow
XSL-FO pages are filled with content from the <fo:flow> element.
The <fo:flow> element contains all the elements to be printed to the page.
When the page is full, the same page master will be used over (and over) again until all the text is printed.
...continue
Where To Flow?
The <fo:flow> element has a "flow-name" attribute.
The value of the flow-name attribute defines where the content of the <fo:flow>
element will go.
The legal values are:
XSL-FO Pages
XSL-FO uses page templates called "Page Masters" to define the layout of pages.
XSL-FO Page Templates
XSL-FO uses page templates called "Page Masters" to define the layout of pages. Each
template must have a unique name:
..continue
XSL-FO Page Size
XSL-FO uses the following attributes to define the size of a page:
..continue
XSL-FO Example
The width of the page is 297 millimeters and the height is 210 millimeters.
The top, bottom, left, and right margins of the page are all 1 centimeter.
The before, after, start, and end regions (of the body) are all 2 centimeters.
The width of the body in the example above can be calculated by subtracting the left
and right margins and the region-body margins from the width of the page itself:
Note that the regions (region-start and region-end) are not a part of the calculation. As described earlier, these
regions are parts of the body.
XSL-FO Blocks
XSL-FO output goes into blocks.
- XSL-FO output is normally nested inside <fo:block> elements, nested inside <fo:flow>
elements, nested inside <fo:page-sequence> elements:
continue
Since block areas are rectangular boxes, they share many common area properties:
margin
border
Padding
The space before and space after is the empty space separating the block from the other blocks.
The margin is the empty area on the outside of the block.
The border is the rectangle drawn around the external edge of the area. It can have different widths
on all four sides. It can also be filled with different colors and background images.
The padding is the area between the border and the content area.
The content area contains the actual content like text, pictures, graphics, or whatever.
..continue
Block Margin
margin
margin-top
margin-bottom
margin-left
margin-right
..continue
Block Padding
padding
padding-before
padding-after
padding-start
padding-end
padding-top (same as padding-before)
padding-bottom (same as padding-after)
padding-left (same as padding-start)
padding-right (same as padding-end)
Block Background
background-color
background-image
background-repeat
background-attachment (scroll or fixed)
..continue
Font attributes
font-family
font-weight
font-style
font-size
font-variant
Example
Result:
XSL-FO Lists
- XSL-FO uses the <fo:list-block> element to define lists.
..continue
Example :
Output:
XSL-FO Tables
XSL-FO uses the <fo:table-and-caption> element to define tables.
XSL-FO Tables
The XSL-FO table model is not very different from the HTML table model.
There are nine XSL-FO objects used to create tables:
fo:table-and-caption
fo:table
fo:table-caption
fo:table-column
fo:table-header
fo:table-footer
fo:table-body
fo:table-row
fo:table-cell
Continue..
Example :
Result:
Result :
XSL-FO Software
XSL-FO needs formatting software to produce output.
XSL-FO Processors
- An XSL-FO processor is a software program for formatting XSL documents for output.
- Most XSL-FO processors can output HTML, PDF documents and quality print.
Antenna House Formatter V5
Antenna House Formatter V5 is a software program to format XML documents for PDF or print.
Visit Antenna House
Altova's StyleVision
StyleVision autogenerates standards-conformant XSLT and XSL:FO stylesheets based on your
design, as well as the corresponding output in HTML, RTF, PDF, Word 2007, and more.
Visit Altova
Ecrion's XF Products
Several products for XSL-FO formatting!
Visit Ecrion
XSL-FO Reference
XSL Formatting Objects Reference
Continue..
Continue
Q&A