Adverts

Let us start this journey into the mysteries of XSLFO with the immortal words: Once upon a time, for all good stories start in this way. Once upon a time there was a web page. It was a high quality web page, full of useful information and nicely laid out. The author cared about his web pages and had made sure they all used XHTML. There was only one problem, when printed the web pages just didn't work. The layout caused the pages to span multiple sheets of paper and the hyper-links that worked so well on the computer just left the reader confused. That was, at least, until the stories night in shining armour came riding onto the scene. His name was XSLFO.

Ok, so perhaps the hero of the story has a somewhat difficult to pronounce name but there is certainly no doubt he saved the day. Taking arbitrary XML data and producing a printed document is not a simple task. A great deal of work has been put into writing specifications and tools that are capable of doing just this and the result is printed material that is consistent and professional.

The problem is that, in general, XML documents have no layout or presentation information so what you see, a huge tree of nodes, is what you get. In fact, it would generally be considered wrong for an XML document to contain formatting information since XML is meant to carry just data – presentation of that data should be left up to another application. This separation of concerns aids reuse and simplifies software development. It is the fundamental reason behind why the W3C are pushing the adoption of XHTML and CSS and why the latest versions of XHTML look so different to HTML – there is no presentation information.

Of course, if you actually want to present the data contained in a block of XML then it is necessary to provide some formatting instructions and that is what XSLFO does. XSLFO can be used to provide physical layout, colouring and typography information to arbitrary XML documents for screen, print, and other media. It is similar in principal to what CSS is trying to do for (X)HTML but far more powerful (and complex).

One of the nicest things about XSLFO is that it is expressed as an XML document itself. This provides enormous flexibility as it means XSLFO can be used with other XML tools such as XSLT and XPath. This means that XML documents can be transformed and prepared for presentation in one simple step or presentation can be decided at transformation type.

XSLFO hasn't grown up in isolation. It builds upon the years of experience gained in the development of CSS and DSSSL in an effort to produce an easy to use and easy to implement formatting language.

From here I suggest you read the Getting Started with XSLFO and FOP page.

Adverts

Donate and Help

Please support this site and
Bandwidth doesn't grow on trees y' know :o)

Adverts

Get Adsense