XSL Formatting Objects

XSL Formatting Objects

Infobox file format
name = XSL Formatting Objects
icon =
logo =
extension = .xml
mime = application/xml, text/xml (deprecated)
type code =
uniform type = public.xml
magic =
owner = [http://www.w3.org/ World Wide Web Consortium]
genre = Markup language
container for =
contained by = XML
extended from =
extended to =
standard = [http://www.w3.org/TR/2006/REC-xsl11-20061205/ 1.1]

XSL Formatting Objects, or XSL-FO, is a markup language for XML document formatting which is most often used to generate PDFs. XSL-FO is part of XSL, a set of W3C technologies designed for the transformation and formatting of XML data. The other parts of XSL are XSLT and XPath. As of December 12, 2006, the current version of XSL-FO is [http://www.w3.org/TR/2006/REC-xsl11-20061205/ v1.1] .

XSL-FO basics

Unlike the combination of HTML and CSS, XSL-FO is a unified presentational language. It has no semantic markup in the way it is meant in HTML. And, unlike CSS which modifies the default presentation of an external XML or HTML document, it stores all of the document's data within itself.

The general idea behind XSL-FO's use is that the user writes a document, not in FO, but in an XML language. XHTML, DocBook, and TEI are all possibilities, but it could be any XML language. Then, the user obtains an XSLT transform, either by writing one themselves or by finding one for the document type in question. This XSLT transform converts the XML into XSL-FO.

Once the XSL-FO document is generated, it is then passed to an application called an FO processor. FO processors convert the XSL-FO document into something that is readable, printable or both. The most common output of XSL-FO is a PDF file or as PS, but some FO processors can output to other formats like RTF files or even just a window in the user's GUI displaying the sequence of pages and their contents.

The XSLT language itself was originally conceived only for this purpose; it has obviously now been supplanted for more general XML transformations. This transformation step is taken so much for granted in XSL-FO that it is not uncommon for people to call the XSLT that turns XML into XSL-FO the actual XSL-FO document itself. Even tutorials on XSL-FO tend to be written with XSLT commands around the FO processing instructions.

The XSLT transformation step is exceptionally powerful. It allows for the automatic generation of a table of contents, linked references, an index, and various other possibilities.

An XSL-FO document is not like a PDF or a PostScript document. It does not definitively describe the layout of the text on various pages. Instead, it describes what the pages look like and where the various contents go. From there, an FO processor determines how to position the text within the boundaries described by the FO document. The XSL-FO specification even allows different FO processors to have varying responses with regard to the resultant generated pages.

For example, some FO processors can hyphenate words to minimize space when breaking a line, while others choose not to. Different processors may even use different hyphenation algorithms, ranging from very simple to more complex hyphenated algorithms that take into account whether the previous or next line also is hyphenated. These will change, in some borderline cases quite substantially, the layout of the various pages. There are other cases where the XSL-FO specification explicitly allows FO processors some degree of choice with regard to layout.

This differentiation between FO processors, creating inconsistent results between processors is often not a concern. This is because the general purpose behind XSL-FO is to generate paged, printed media. XSL-FO documents themselves are usually used as intermediaries, mostly to generate either PDF files or a printed document as the final form to be distributed. This is as opposed to how HTML is generated and distributed as a final form directly to the user. As such, a person wanting to generate a printed document only has to select the FO processor that fulfills their needs, usually in the realm of layout quality and reduction of unnecessary whitespace, rather than having to test their XSL-FO document on multiple processors.

XSL-FO language concepts

The XSL-FO language was designed for paged media, in much the same way that HTML and CSS were designed for unpaged (or screen-based) media. As such, the concept of pages is an integral part of XSL-FO's structure, and FO gives the user significant power in dealing with how information is displayed on a page.

FO works best for what could be called "content-driven" design. This is the standard method of layout for books, articles, legal documents, and so forth. It involves a single flowing span of fairly contiguous text, with various repeating information built into the margins of a page. This is as opposed to "layout-driven" design, which is used in newspapers or magazines. If content in those documents does not fit in the required space, some of it is trimmed away until it does fit. XSL-FO does not easily handle the tight restrictions of magazine layout; indeed, in many cases, it lacks the ability to express some forms of said layout.

Despite the basic nature of the language's design, it is capable of a great deal of expressiveness. Tables, lists, side floats, and a variety of other features are available. These features are comparable to CSS's layout features, though some of those features are expected to be built by the XSLT.

XSL-FO document structure

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.

XSL-FO documents contain two required sections. The first section details a list of named page layouts. The second section is a list of document data, with markup, that uses the various page layouts to determine how the content fills the various pages.

Page layouts define the properties of the page. 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 for printing purposes; this allows more space to be given to the margin where the book will be bound.

The document data portion is broken up into a sequence of flows, where each flow is attached to a page layout. The flows contain a list of blocks which, in turn, each contain a list of text data, inline markup elements, or a combination of the two. Content may also be added to the margins of the document, for page numbers, chapter headings and the like.

Blocks and inline elements function in much the same way as for CSS, though some of the rules for padding and margins differ between FO and CSS. The direction, relative to the page orientation, for the progression of blocks and inlines can be fully specified, thus allowing FO documents to function under languages that are read different from English. The language of the FO specification, unlike that of CSS 2.1, uses direction-neutral terms like start and end rather than left and right when describing these directions.

XSL-FO's basic content markup is derived from CSS and its cascading rules. As such, many attributes in XSL-FO propagate into the child elements unless explicitly overridden.

Capabilities of XSL-FO v1.0

XSL-FO is capable of a great deal of textual layout functionality. In addition to the information as specified above, XSL-FO's language allows for the specification of the following.

Multiple columns

A page can be defined to have multiple columns. When this is the case, blocks flow from one column into the next by default. Individual blocks can be set to span all columns, creating a textual break in the page. The columns above this break will flow into each other, as will the columns below the break. But no text is allowed to flow from the above section to the below section.

Because of the nature of XSL-FO's page specification, multiple pages may actually have different numbers and widths of columns. As such, text can flow from a 3 column page to a 5 column page to a 1 column page quite easily.

All FO features work within the restrictions of a multi-column page.

Lists

An XSL-FO list is, essentially, two sets of blocks stacked side by side. An entry consists of a block on the "left", or start inline direction, and a block sequence on the "right", or end inline direction. The block on the left is conceptually what would be the number or bullet in a list. However, it could just as easily be a string of text, as one might see in a glossary entry. The block on the right works as expected. Both of these blocks can be block containers, or have multiple blocks in a single list entry.

Numbering of XSL-FO lists, when they are numbered, is expected to be done by the XSLT, or whatever other process, that generated the XSL-FO document. As such, number lists are to be explicitly numbered in XSL-FO.

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

The user can create footnotes that appear at the bottom of a page. The footnote is written, in the FO document, in the regular flow of text at the point where it is referenced. The reference is represented as an inline definition, though it is not required. The body is one or more blocks that are placed by the FO processor to the bottom of the page. The FO processor guarantees that wherever the reference is, the footnote cited by that reference will begin on the same page. This will be so even if it means creating extra empty space on a page.

Tables

A FO table functions much like an HTML/CSS table. The user specifies rows of data for each individual cell. The user can, also, specify some styling information for each column, such as background color. Additionally, the user can specify the first row as a table header row, with its own separate styling information.

The FO processor can be told exactly how much space to give each column, or it can be told to auto-fit the text in the table.

Text orientation controls

FO has extensive controls for orienting blocks of text. One can, in the middle of a page, designate a block of text to be oriented in a different orientation. These oriented blocks can be used for languages in a different orientation from the rest of the document, or simply if one needs to orient the text for layout purposes. These blocks can contain virtually any kind of content, from tables to lists or even other blocks of reoriented text.

Miscellaneous

* 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

Capabilities of XSL-FO v1.1

Version 1.1 of XSL-FO adds a number of new features to version 1.0.

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.

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.

XSL-FO v1.1 now provides the ability to create named bookmarks in XSL-FO, thus allowing the processor to pass this on to an output format that supports it.

Indexing

XSL-FO 1.1 has 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

XSL-FO 1.1 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

XSL-FO 1.1 refines the functionality for sizing of graphics to fit, with the ability to shrink 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").

Advantages of XSL-FO

Because it is an XML language, only an XSLT transform (and an XSLT processor) are required to generate XSL-FO code from any XML language. One can easily write a document in TEI or DocBook, and transform it into HTML for web viewing or PDF (through an FO processor) for printing. In fact, there are many pre-existing TEI and DocBook XSLTs for both of these purposes.

Another advantage of XSL-FO is the relative ease of use. Much of the functionality of the language is based on work from CSS, so a CSS user will be familiar with the basics of the markup attributes. Understanding what a specific section of an FO document will look like is usually quite easy. This is compared to layout and typesetting packages like TeX, which are generally considered arcane.

Compared with commercial typesetting and page layout products, XSL-FO can offer a much lower cost solution when it otherwise meets the typographic and layout requirements (see below). The initial cost of ownership is low (zero if the free implementations, such as Apache FOP and [http://xmlroff.org xmlroff] , meet your requirements), especially compared to the cost of commercial composition tools. The skills required (primarily XSLT programming) are widely available. There are a number of good books on XSL-FO as well as online resources and an active user community.

XSL-FO has been designed to work for all written human languages and the implementations have largely achieved that goal. This makes XSL-FO particularly well suited for composing documents localized into a large number of national languages where the requirement is to have a single tool set that can compose all the language versions of documents. This is especially valuable for technical documentation for things like consumer electronics, where Asian and Middle Eastern languages are important because those parts of world represent huge markets for things like mobile phones and computer peripherals.

With the publication of XSL-FO 1.1, XSL-FO is proving to be a mature standard with a number of solid commercial and non-commercial implementations. There is no other comparable standard for page composition.

Drawbacks of XSL-FO

XSL-FO was specifically designed to meet the requirements of "lightly designed" documents typified by technical manuals, business documents, invoices, and so on. While it can be and is used for more sophisticated designs, it is inherently limited in what it can do from a layout and typographic perspective. In particular, XSL-FO does not provide a direct way to get formatting effects that depend on knowing the page position relationship of two formatting objects. For example, there is no direct way to say "if this thing is on the same page as that thing, then do X, otherwise do Y". This is an explicit design decision reflecting the two-stage, transform-based abstract processing model used by XSL-FO. This limitation can be addressed by implementing a multi-pass process. Unfortunately, there is currently no standard for how the result of the first pass would be communicated back to the second pass. Most, if not all, implementations provide some form of processable intermediate result format that can be used for this, but any such process implemented today would, by necessity, be implementation specific.

By the same token, there are important layout features that are simply not in XSL-FO, either because they were not of high enough priority or because designing them was too difficult to allow inclusion in version 1.1, or because there were insufficient implementations to allow their inclusion in the final specification per W3C rules.

In addition to these architectural limitations, the current XSL-FO implementations, both commercial and open source, do not provide the same level of typographic sophistication that high-end layout tools like QuarkXPress, Arbortext Advanced Print Publishing, and InDesign provide. For example, no current implementation provides features for ensuring that text lines on facing pages are lined up vertically. There is nothing in the XSL-FO specification that prevents it but nothing that requires it either. For most documents for which a completely-automated composition solution is sufficient, that level of typographic sophistication is not needed. However, for high-end publications and mass-market books, it usually is.

When considering the applicability of XSL-FO to a particular document or document design, one must consider proprietary extensions provided by the different XSL-FO implementations. These extensions add features that are not part of the core specification. For example, one product adds support for Japanese typographic conventions that the XSL-FO specification does not address. However, use of these features makes such an XSL-FO system a little more bound to a specific implementation (but not completely bound as it would be when using a totally proprietary composition system.)

While it is theoretically possible to have an XSL-FO-based system that allows formatting adjustment following the initial composition process, no current systems provide that functionality and it is generally impractical to edit XSL-FO instances by hand (XSL-FO was designed for clarity and completeness, not ease of editing.)

When trying to decide whether or not XSL-FO will work for a given document, the following typographic and layout requirements usually indicate that XSL-FO will not work (although some of these may be satisfied by proprietary extensions):

*Need to restart footnote numbers or symbol sequence on each new page.
*Need to run text around both sides of a floated object (XSL-FO can run text around one side and the top and/or bottom, but not both sides.)
*Need to have variable numbers of columns on a single page (however, at least two commercial implementations provide extensions for creating multi-column blocks within a page.)
*Need to have column-wide footnotes (several implementations provide column footnote extensions.)
*Need to have marginalia that is dynamically placed relative to other marginalia (for example, marginal notes that are evenly spaced vertically on the page). XSL-FO only provides features for placing marginalia so that it is vertically aligned with its anchor.
*Need to create content that spreads across two pages as a float or "out of line" object in an otherwise homogeneous sequence of repeating page masters (this can be done in XSL-FO 1.1 using multiple body regions and flow maps, but it requires being able to control the page masters used for those pages.)
*Need both bottom-floated content and footnotes on the same page.
*Need to be able to run text against an arbitrary curve (though some implementation support SVG, which can be used to get around this limitation).
*Need to be able to constrain lines to specific baseline grids (for example, to achieve exact registration of lines on facing pages.)
*Anything that requires page-aware layout, such as ensuring that a figure always occurs on the page facing its anchor point.

ee also

*XML
*XSL
*XSLT
*Cascading Style Sheets
*XHTML
*Apache FOP - Open source and royalty free implementation of XSL-FO

External links

* [http://www.w3.org/TR/2001/REC-xsl-20011015/ XSL-FO 1.0 Specification]
* [http://www.w3.org/TR/xsl11/ XSL-FO 1.1 Specification]
* [http://www.xml.com/pub/a/2002/03/20/xsl-fo.html What is XSL-FO?] on XML.com
* [http://www.w3schools.com/xslfo/default.asp W3 Schools] A good source for beginners and dabblers
* [http://www.dpawson.co.uk/xsl/sect3/index.html FO examples and techniques] Excellent reference site set up by Dave Pawson, for those who want to use FOP, but were afraid to ask.
* [http://www.gilbane.com/gilbane_report.pl/94/XSLFO_Ready_for_Prime_Time.html XSL-FO: Ready for Prime Time?] on the Gilbane Report
* [http://www.antennahouse.com/XSLsample/XSLsample.htm XSL-FO Tutorial and Samples] on [http://www.antennahouse.com Antenna House]
* [http://www.data2type.de/xml/XSL-FO.html Data2Type] (German) XSL-FO information
* [http://www.renderx.com/tutorial.html XSL Formatting Objects Tutorial] on [http://www.renderx.com/ RenderX]
* [http://www.ecrion.com/Support/Resources/XSL-FOTutorial/toc.xml.html XSL-FO Tutorial and Samples] on [http://www.ecrion.com Ecrion.com]


Wikimedia Foundation. 2010.

Игры ⚽ Поможем решить контрольную работу

Look at other dictionaries:

  • XSL Formatting Objects — XSL FO (Extensible Stylesheet Language – Formatting Objects) ist eine XML Anwendung, die beschreibt, wie Text, Bilder, Linien und andere grafische Elemente auf einer Seite angeordnet werden. Mit Hilfe von XSL FO ist es möglich, qualitativ… …   Deutsch Wikipedia

  • XSL Formatting Objects — XSL FO (англ. eXtensible Markup Language Formatting Objects объекты форматирования языка таблиц стилей для Консорциумом Всемирной паутины язык разметки типографских макетов и иных предпечатных материалов. XSL FO является частью XSLT и HTML и CSS …   Википедия

  • XSL Formatting Objects — Un documento XSL FO es un documento XML en el que se especifica cómo se van a formatear unos datos para presentarlos en pantalla, papel u otros medios. El significado de las siglas XSL FO es eXtensible Stylesheet Language Formatting Objects. Hay… …   Wikipedia Español

  • Formatting Objects Processor — Infobox Software name = Apache FOP caption = developer = Apache Software Foundation latest release version = 0.95 latest release date = release date|2008|08|05 latest preview version = latest preview date = operating system = Cross platform… …   Wikipedia

  • Formatting Objects Processor — Apache FOP Тип XSL FO Разработчик Apache Software Foundation …   Википедия

  • Extensible Stylesheet Language - Formatting Objects — XSL FO (Extensible Stylesheet Language – Formatting Objects) ist eine XML Anwendung, die beschreibt, wie Text, Bilder, Linien und andere grafische Elemente auf einer Seite angeordnet werden. Mit Hilfe von XSL FO ist es möglich, qualitativ… …   Deutsch Wikipedia

  • Extensible Stylesheet Language – Formatting Objects — XSL FO (Extensible Stylesheet Language – Formatting Objects) ist eine XML Anwendung, die beschreibt, wie Text, Bilder, Linien und andere grafische Elemente auf einer Seite angeordnet werden. Mit Hilfe von XSL FO ist es möglich, qualitativ… …   Deutsch Wikipedia

  • XSL — (Extensible Stylesheet Language) ist eine in XML notierte Familie von Transformationssprachen zur Definition von Layouts für XML Dokumente. Die XSL Subsprache XSLT wird außerdem zur Übersetzung/Transformation eines XML Formats in ein anderes XML… …   Deutsch Wikipedia

  • XSL — (eXtensible Stylesheet Language) семейство рекомендаций консорциума W3C, описывающее языки преобразования и визуализации XML документов. Состоит из трех частей: XSL Transformations (XSLT) язык преобразований XML документов. XSL Formatting Objects …   Википедия

  • Apache Formatting Objects Processor — Apache FOP Entwickler Apache Software Foundation Aktuelle Version 1.0 (21. Juli 2010) Programmier­sprache Java Kategorie XSL FO Lizenz …   Deutsch Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”