When dealing with XML documents, while you may be a developer who can look at the document and understand it, most average website visitors cannot and as a result the World Wide Web Consortium decided that a manner of formatting the XML documents was needed. This decision led to the formation of a W3C workgroup which developed what has become known as the Extensible Stylesheet Language. However, in developing the XSL, there was a determination that it was going to have to be split into three subsets which includes the XSLT, XPath as well as the XSL Formatting Objects.
Imagine formatting an XML document into an easy to read and understand PDF file. Sounds a bit far fetched to some, but with the help of XSL-FO this can be achieved. While it can be considered similar to that of the Cascading Stylesheets as associated with an HTML document; that is where the similarities end. A CSS file stores its data for remote HTML documents whereas an XSL-FO document stores all of its formatting information within itself.
When a user creates an XML document whether it is an actual XML file, or even an XHTML or DocBook file, this is written in the standard XML format. Then using XSLT transformations, the document gets stored as an XSL-FO file for later use. When this file is called by the Formatting Objects processor, the processor will convert this file into a legible format which can include PDF, RTF as well as PS formats.
During its original development, this was the concept behind the XSL-FO, however since its inception, it has become very widespread and is used for many other purposes. You can use this to create a table of contents or even a sitemap. However, it is important to point out that while storing the XML file as an XSL-FO file, even if it is intended to be output as a PDF, PS or RTF format, until it is actually processed and opened in the browser, the XSL-FO file will not look like these formats. It is the processor’s job to put as little amount of strain on the server as possible when formatting these documents which means that the processor can hyphen words as a replacement for a line break. These can be simple or very complex algorithms which are used by the processor, but the end result is the same and that is that an XSL-FO file which will be later formatted in a browser as say a PDF file, is much smaller in size than having to actually store the PDF file.
Of course when using the XSL-FO, you will also have to have an understanding of all three of the subsets in the Extensible Stylesheet Language as they are in fact intertwined with each other. You will not be able to work with the XSL-FO file when writing it as an XML without also having to deal with the XPath for links and the XSLT for the transformation of resources.
Original Authors: Nick
Edit Update Authors: M.A.Harris
Updated On: 04/03/2009