XSL Formatting Objects
P.DHIVYA AP/CSE SNS COLLEGE OF TECHNOLOGY
SERVICE ORIENTED ARCHITECTURE 1 of 18 Introduction
• The XSL technology is also composed of XSL Formatting Objects (XSL- FO). XSL-FO was designed to assist with the printing and displaying of XML data. The main emphasis is on the document layout and structure. This includes the dimensions of the output document, including page headers, footers, and margins. XSL-FO also allows the developer to define the formatting rules for the content, such as font, style, color, and positioning. • XSL-FO is a sophisticated version of Cascading Style Sheets (CSS). In fact, XSL-FO borrows a lot of the terminology and elements from CSS. • XSL-FO documents are well-formed XML documents. An XSL-FO formatting engine processes XSL-FO documents. You can use two techniques for creating XSL-FO documents. • The first is to simply develop the XSL-FO file with the included data. The second technique is to dynamically create the XSL-FO file using an
IT6801-SERVICE ORIENTED ARCHITECTURE 2 of 18 XSL FO Engine
IT6801-SERVICE ORIENTED ARCHITECTURE 3 of 18 Apache XSL-FOP generating PDF Documents
IT6801-SERVICE ORIENTED ARCHITECTURE 4 of 18 Basic Document Structure
An XML-FO document follows the syntax rules of XML; as a result, it is well formed . XSL-FO elements use the following namespace: • http://www.w3.org/1999/XSL/Format The following code snippet shows the basic document setup for XSL-FO:
IT6801-SERVICE ORIENTED ARCHITECTURE 5 of 18 Page Master:
The page master describes the page size and layout. For example, we could use an 8.5 11-inch page or an A4 letter. The page master contains the dimensions for a page, including width, height, and margins. The page master is similar to a slide master in Microsoft PowerPoint. The
IT6801-SERVICE ORIENTED ARCHITECTURE 6 of 18 Components of Page Master
IT6801-SERVICE ORIENTED ARCHITECTURE 7 of 18 XSL FO DIMENSIONS
IT6801-SERVICE ORIENTED ARCHITECTURE 8 of 18 Five Regions of a Page
The size of the regions using the following elements: •
IT6801-SERVICE ORIENTED ARCHITECTURE 9 of 18 Page Master Set:
IT6801-SERVICE ORIENTED ARCHITECTURE 10 of 18 Page Sequences:
IT6801-SERVICE ORIENTED ARCHITECTURE 11 of 18 Contd..,
IT6801-SERVICE ORIENTED ARCHITECTURE 12 of 18 Graphics
• XSL-FO also allows for the insertion of external graphic images. The graphic formats supported are dependent on the XSL-FO formatting engine. The Apache-FOP formatting engine supports the popular graphics formats: GIF, JPEG, and BMP. • The following code fragment inserts the image smiley.jpg:
IT6801-SERVICE ORIENTED ARCHITECTURE 13 of 18 Inserting a graphic Image in a PDF Document
IT6801-SERVICE ORIENTED ARCHITECTURE 14 of 18 Tables
• XSL-FO has rich support for structuring tabular data. In fact, there are many similarities between HTML tables and XSL-FO tables .
IT6801-SERVICE ORIENTED ARCHITECTURE 15 of 18 Comparing HTML Table Elements with XSL FO Elements ERROR: stackunderflow OFFENDING COMMAND: ~ STACK: