XSL Formatting

XSL Formatting

As discussed in Chapter 1, XSLT and XSL-FO together make up the XSL specification. Currently, version 1.0 of that specification has candidate recommendation status, and youll find the latest version at www.w3.org/TR/xsl.

The XSL-FO part of XSL enables you to format the exact appearance of a document, down to the last millimeter. For example, you can select what font to use, what font size , where on a page to position text, what its color should be, whether it should be underlined , and so on. In fact, using XSL-FO is much like creating RTF documents, with some extrasfor example, you can create links in XSL-FO that enable you to navigate between documents.

As you can imagine, if youve ever seen the large number of codes RTF uses to format a document, XSL-FO is a complex and very large specification. (This is why XSLT was introduced to make it easier to work with.) So, theres only room for an introduction to the topic here. In fact, no software implements the entire specification yet, so relatively few people use XSL-FO beyond the what is covered in this and the next chapter. The following list includes some XSL-FO processors that are available:

  • fop. http://xml.apache.org/fop. This popular processor converts XSL-FO to PDF. Developed by James Tauber at the Apache Software Foundation (//xml.apache.org/).

  • PassiveTeX . http://users.ox.ac.uk/~rahtz/passivetex/. This processor is actually a library of TeX macros that provides an environment for testing XSL-FO.

  • REXP. www.esng.dibe.unige.it/REXP. This early version of an XSL-FO processor is based on fop. Creates PDF files.

  • Unicorn . www.unicorn- enterprises .com. This processor (named UFO) is free and runs on Windows NT 4.0 and Windows 95.

  • XEP. www. renderx .com/FO2PDF.html. () This processor, which used to be called FOP2PDF, converts XSL-FO documents to PDF format.

  • XSL Formatter. www.antennahouse.com/xslformatter.html. An XSL-FO processor for Windows. A free evaluation version is available.

My personal favorite, and currently the most popular XSL-FO processor, is fop. I use the latest version of fop, version 0.17, in this and the next chapter. The Apache Software Foundation, the same group that creates Xalan, maintains the fop processor, which converts XSL-FO documents to Portable Data Format (PDF) documents, which you can view with the Adobe Acrobat PDF reader. You can get the Acrobat reader for free at www.adobe.com/products/acrobat/readermain.html. You can get the latest version of fop itself for free at http://xml.apache.org/fop (currently, you just click the download link in that page).

The fop processor works on XSL-FO documents, and in this and the next chapter, I use XSLT to transform XML documents to XSL-FO format and then use fop to convert XSL-FO documents to PDF format. (Using XSL-FO does not automatically mean creating PDF documentsthere are other formats aroundXSL-FO simply enables you to format data, and how that formatted data is presented is up to the application youre using). To work with XSL-FO, you have to understand the available XSL formatting objects.



Inside XSLT
Inside Xslt
ISBN: B0031W8M4K
EAN: N/A
Year: 2005
Pages: 196

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net