Presents your XML E-NEWSLETTER for July 3, 2002 -------------------------------------------- XSL FORMATTING OBJECTS REVEALED Rendering data into a usable format for print media is a common problem in technology. To this end, many formats were devised to handle the physical representation of data. For example, Adobe's Portable Document Format (PDF) is popular for sharing formatted documents on the Internet. Although there are many formats available, such as PDF and PostScript, there is still the problem of describing information in such a way that it can be retargeted for other formats. To solve this problem, the W3C has developed the XSL Formatting Objects (XSL-FO) recommendation. Several vendors, including IBM and Apache, have followed with implementations. http://www.w3.org/TR/xsl/ OVERVIEW XSL-FO is in many ways a sibling to XSLT, the style sheet transformation language usually focused on when discussing XSL. XSLT is used to describe how to transform XML elements while XSL-FO is used to describe how to render XML documents for presentation. XSL-FO documents specify the layout to apply to XML documents. PAGE BY PAGE XSL-FO allows you to specify the properties for the page you wish to render. This includes common properties such as page width and height as well as all four margins. You can define each page using the element, and you can group multiple elements into a . A set of pages is physically defined using the element. Rather than being child elements of a element, elements refer to the proper page master by name. GO WITH THE FLOW Within each page, there are five independent regions you can use to lay out information. Think of these regions as the header, footer, left side, right side, and body. Within the header and footer region (respectively called xsl-region-before and xsl-region-after), you can specify information that should appear on each page. When you use the element, the information is rendered for each page in the sequence. The actual content of each page usually belongs in the xsl-region-body region. Unlike headers and footers, which typically use elements to describe their data, content data is delivered in elements. Within the flow, you can provide multiple elements that describe individual blocks of text. You can format each block using the appropriate font, style, and color. IMAGE-IN THAT Of course, what good would a presentation language be without some eye-candy? XSL-FO provides support for graphics using the element. You can specify any type of graphic you want; however, your formatting engine must be able to understand the image type you want it to render. Using Internet-friendly formats such as JPEG and GIF should keep things running smoothly. TURNING THE TABLES XSL-FO allows you to go beyond simple text blocks as well. Using the element is similar to using HTML elements. Within each table, you can define a header, a body, and a footer. Each header and body is composed of rows, and each row is composed of individual cells. Within each cell, you can specify individual text blocks, using , to provide information that should appear within that cell in the layout. You can also specify the particular properties of the table (such as column width). Brian Schaffner is a senior consultant for Fujitsu Consulting. He provides architecture, design, and development support for Fujitsu's Telcom360 group. ----------------------------------------