part ii

20
1 Part II Part II XSL Formatting Objects

Upload: willem

Post on 06-Jan-2016

22 views

Category:

Documents


0 download

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 Presentation

TRANSCRIPT

Page 1: Part II

1

Part IIPart II

XSL Formatting Objects

Page 2: Part II

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

Page 3: Part II

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

Page 4: Part II

4

More Trees to BuildMore Trees to BuildFormatting Object Tree

Page 5: Part II

5

More Trees to BuildMore Trees to BuildGenerate the Area Tree

Page 6: Part II

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

Page 7: Part II

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

Page 8: Part II

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

Page 9: Part II

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

Page 10: Part II

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

Page 11: Part II

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

Page 12: Part II

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

Page 13: Part II

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

Page 14: Part II

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

Page 15: Part II

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

Page 16: Part II

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

Page 17: Part II

17

Output ExamplesOutput ExamplesDirection

Page 18: Part II

18

More Output ExamplesMore Output ExamplesAlignment and Images

Page 19: Part II

19

ToolsTools

FOP

http://www.apache.org/fop More in the future

Page 20: Part II

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