XSL-FO (XSL Formatting Objects) is a markup language for XML document formatting that is most often used to generate PDF files. It has largely been superseded by the CSS3 but is still maintained for legacy systems. It is an intermediary file format with the purpose of generating paged, printed media. The intended workflow is to transform an XML file into XSL-FO by writing and running a script in the XSLT programming language and then transform the XSL-FO file into PDF or other formats with a software called XSL-FO processor. The XSLT script only needs to be written once for each document type. The XSL-FO specification was originally published under the ambiguous title XSL 1.0 in October 2001 declaring XSLT to be the other half but only linking the 1999 XSLT specification rather than including it. Version 1.1 was published as XSL 1.1 in December 2006. The last update for the 2.0 Working Draft was in January 2012, and its Working Group closed in November 2013. The XSLT language itself was originally conceived only to transform to XSL-FO but is now used for more general XML transformations. The XSL-FO specification allows different FO processors to have varying responses with regard to the resultant generated pages. For example, different processors may even use different hyphenation algorithms, ranging from very simple to more complex hyphenation algorithms that take into account whether the previous or next line also is hyphenated. This can substantially change the layout. FO works best for a single flowing span of fairly contiguous text, with various repeating information built into the margins of a page. This is as opposed to complex layouts used in newspapers or magazines.
File structure The following is a minimalist XSL-FO file with only the required markup to show "Hello World".XSL-FO documents are XML documents, but they do not have to conform to any DTD or schema. Instead, they conform to a syntax defined in the XSL-FO specification. <fo:layout-master-set> details a list of named page layouts. <fo:page-sequence> is a list of document data, with markup, that uses the various page layouts to determine how the content fills the various pages. Layout masters define the properties of a page sequence. They can define the directions for the flow of text, so as to match the conventions for the language in question. They define the size of a page as well as the margins of that page. More importantly, they can define sequences of pages that allow for effects where the odd and even pages look different. For example, one can define a page layout sequence that gives extra space to the inner margins of a book. Page sequences are divided into flows and flows into blocks. Blocks can contain a contain text data and <fo:inline> elements. Content may also be added to the margins of the document, for page numbers, chapter headings and the like. Blocks and inline elements function similarly as in CSS, though some of the rules for padding and margins differ between FO and CSS. XSL-FO's basic content markup is derived from CSS and its cascading rules.
XSL-FO 1.0 In addition to the information as specified above, the following is supported:
Pages with multiple columns Lists Pagination controls: The user can specify Widow and Orphan for blocks or for the flow itself, and allow the attributes to cascade into child blocks. Additionally, blocks can be specified to be kept together on a single page. For example, an image block and the description of that image can be set to never be separated. The FO processor will do its best to adhere to these commands, even if it requires creating a great deal of empty space on a page. Footnotes Tables Text orientation controls: One can, in the middle of a page, designate a block of text to be oriented in a different orientation. Text direction for each element Page number citations. A page that contains a special tag can be cited in text, and the FO processor will fill in the actual page number where this tag appears. Block borders, in a number of styles. Background colors and images. Font controls and weighting, as in CSS. Side floats. Miscellaneous Inline Elements. Attribute propagation like in CSS
XSL-FO 1.1 New features:
Multiple flows and flow mapping: XSL-FO 1.0 was fairly restrictive about what text was allowed to go in what areas of a page. Version 1.1 loosens these restrictions significantly, allowing flowing text to be mapped into multiple explicit regions on a page. This allows for more newspaper-like typesetting. Named Bookmarks: Many output formats for XSL-FO processors, specifically PDF, have bookmarking features. These allow the format to specify a string of text in a separate window that can be selected by the user. When selected, the document window scrolls immediately to a specific region of the document. Indexing: features that support the generation of an index that might be found at the back of a book. This is done through referencing of properly marked-up elements in the FO document. Last page citation: The last page can be generated without providing an explicit in-document reference to a specific anchor in the FO document. The definition of "last page" can be restricted to within a specific set of pages or to cover the entire document. This allows the user to specify something like, "Page 2 out of 15", where page 15 is the page number of a last page definition. Table markers: Table markers allow the user to create dynamic content within table headers and footers, such as running totals at the bottom of each page of a table or "table continued" indicators. Inside/outside floats: adds the keywords "inside" and "outside" for side floats, which makes it possible to achieve page layouts with marginalia positioned on the outside or inside edges of pages. Inside refers to the side of the page towards the book binding, and outside refers to the side of a page away from the book binding. Refined graphic sizing: adds the ability to shrink graphics to fit (but not grow to fit), as well as the ability to define specific scaling steps. In addition, the resulting scaling factor can be referenced for display (for example, to say in a figure caption, "image shown is 50% actual size").
Limitations
… excerpt ends here. Continue reading the full article.
