part ii
DESCRIPTION
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 - PowerPoint PPT PresentationTRANSCRIPT
1
Part IIPart II
XSL Formatting Objects
2
What’s XSL FO ?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 ?
This part is simplified in this picture
3
Why XSL FO ?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 BuildMore Trees to BuildFormatting Object Tree
5
More Trees to BuildMore Trees to BuildGenerate the Area Tree
6
FormattingFormatting
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 ModelXSL Formatting ModelArea 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: Regions Block areas Line areas Inline areas
8
Area TreeArea 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 ObjectsFormatting 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 ObjectsFormatting Objects
The formatting behavior of each class of formatting objects is described in terms of :
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
11
Formatting PropertiesFormatting 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 DocumentXSL FO Document
A Well-formed XML document, that uses XSL FO vocabulary: Follow XML syntax rules
Use .fob or .fo as extensions for files containing XSL formatting objects
.xml extension can also be used
13
XSL FO documentXSL FO documentStructure
Start with: <? Xml version=“1.0” encoding=“utf-8”?> <fo:root>
Continue with: The layout master set, which consists of
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 ?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 DocumentA 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
OutputOutput
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 ExamplesOutput ExamplesDirection
18
More Output ExamplesMore Output ExamplesAlignment and Images
19
ToolsTools
FOP
http://www.apache.org/fop More in the future
20
ReferencesReferences
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