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: The element is the root element for the XSL-FO document. An XSL-FO document can contain the following components: • Page master • Page master set • Page sequences

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.511-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 element defines the layout of a page . The following code snippet describes a U.S. letter:

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: A document can be composed of multiple pages, each with its own dimensions . The page master set refers to the collection of page masters. In the following code example, a page master set is defined that contains one page set:

IT6801-SERVICE ORIENTED ARCHITECTURE 10 of 18 Page Sequences: The following code fragment defines a page sequence. This sequence uses the simple page master we defined earlier in this section. Also, the element contains two elements. Here’s the code:

IT6801-SERVICE ORIENTED ARCHITECTURE 11 of 18 Contd..,

Welcome to Ez Books Online, the world’s smallest online book store. Our company’s mission is to sell books on Java, Thrillers and Romance. We have something for everyone...so we think. Feel free to browse our catalog and if you find a book of interest then send us an e-mail. Thanks for visiting!

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: