1 / 20

Part II

Part II. XSL Formatting Objects. This part is simplified in this picture. What’s XSL FO ?. An XML application that describes how pages will look when presented to a reader

willem
Download Presentation

Part II

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Part II XSL Formatting Objects

  2. This part is simplified in this picture What’s XSL FO ? • An XML application that describes how pages will look when presented to a reader • Interprets the result tree in its formatting object tree form to produce the presentation intended by the designer of the stylesheet Remember the tree graph from Part I ?

  3. Why XSL FO ? • Provides a more sophisticated visual layout model than HTML+CSS • Formatting supported by XSL FO includes right-to-left and top-to-bottom text, footnotes, margin notes, page numbers in cross-references, and more • CSS is primarily intended for use on the Web, while XSL-FO is designed for broader use, ex. lay out an entire printed book

  4. More Trees to Build Formatting Object Tree

  5. More Trees to Build Generate the Area Tree

  6. Formatting • The process of turning the result of an XSL transformation into a tangible form for the reader or listener • Constructing an area tree

  7. XSL Formatting Model • Based on rectangular boxes called areas that can contain text, empty space, images, or other formatting objects • An XSL formatter reads the formatting objects to determine which areas to place where on the page • When processed, the formatting objects document is broken up into pages • Each page contains a number of areas which include: Area Model • Regions • Block areas • Line areas • Inline areas

  8. Area Tree • An ordered tree containing geometric information for the placement of every shape and image in the document • Together with information embodying spacing constraints and other rendering information • This information is referred to under the rubric of traits, which are to areas what formatting properties are to formatting objects and attributes are to XML elements

  9. Formatting Objects • They are elements (nodes) in the formatting object tree, whose names are from the XSL namespace • Belongs to a class of formatting objects identified by its element name

  10. Formatting Objects • what areas are created by a formatting object of that class • how the traits of the areas are established • how the areas are structured hierarchically with respect to areas created by other formatting objects The formatting behavior of each class of formatting objects is described in terms of :

  11. Formatting Properties • When taken as a whole, the various formatting objects in an XSL-FO document specify the order in which content is to be placed on pages • Formatting properties specify the details of formatting such as size, position, font, color and more • Formatting properties are represented as attributes on the individual formatting object elements

  12. XSL FO Document • Follow XML syntax rules • Use .fob or .fo as extensions for files containing XSL formatting objects • .xml extension can also be used A Well-formed XML document, that uses XSL FO vocabulary:

  13. XSL FO document • Start with: • <? Xml version=“1.0” encoding=“utf-8”?> • <fo:root> • Continue with: • The layout master set, which consists of Structure • Descriptions of the kinds of pages that can occur in the document • Sequences in which those page formats can occur • The pages and their content

  14. The Details ? • There are exactly 56 XSL formatting object elements • More than 200 separate XSL formatting properties • We will NOT cover the details about how to use them, consult the XSL specification if interested • The only tools that can render the XSL FO file to an output medium that I know so far is FOP – Formatting Object print formatter • We will show you some example documents and some pdf displays ** see details of FOP at http://www.apache.org/fop

  15. A Simple Document <fo:root xmlns:xlink="http://www.w3.org/2000/xlink/namespace/" xmlns:fo="http://www.w3.org/1999/XSL/Format"> <fo:layout-master-set> <fo:simple-page-master margin-right="50pt" margin-left="50pt" margin-bottom="50pt" margin-top="50pt" page-width="792pt" page-height="612pt"> <fo:region-body/> </fo:simple-page-master> </fo:layout-master-set> <fo:page-sequence> <fo:flow> <fo:block line-height="80pt" font-size="72pt" font-family="Helvetica"> FOP ain't fopped! </fo:block> </fo:flow> </fo:page-sequence> </fo:root> Formatting Objects Formatting Properties

  16. Output • Use the FOP (FO print formatter ) to transform formatted object tree into a PDF format • View it in Adobe’s Acrobat PDF viewer

  17. Output Examples Direction

  18. More Output Examples Alignment and Images

  19. Tools • FOP http://www.apache.org/fop • More in the future 

  20. References • W3C Proposed Recommendation 28 August 2001, http://www.w3.org/TR/xsl • Chapter 17 of “ XML Bible ” by Elliotte Rusty Harold http://www.ibiblio.org/xml/books/bible2/chapters/ch17.html • http://www.xml.com/lpt/a/2001/01/17/xsl-fo/index.html • http://www.sun.com/software/xml/developers/slides-dtd

More Related