Date post: | 07-Apr-2018 |
Category: |
Documents |
Upload: | inderpreet-singh |
View: | 221 times |
Download: | 0 times |
of 73
8/4/2019 Intro2XSL-FO
1/73
Introduction to XSL-FO Concepts
(Printing Directly from XML)
Deborah Aleyne Lapeyre and B. Tommie UsdinMulberry Technologies Inc.17 West Jefferson St.Suite 207Rockville MD 20850Phone: 301/315-9631Fax: 301/[email protected]://www.mulberrytech.com
Version 1.0 (January 2006)2006 Mulberry Technologies, Inc.
8/4/2019 Intro2XSL-FO
2/73
8/4/2019 Intro2XSL-FO
3/73
Introduction to XSL-FO ConceptsAdministrivia......................................................................................................................1What is XSL-FO................................................................................................................4
Design Goals for XSL Formatting....................................................................................5The XSL Specification......................................................................................................5The Dream Behind XSL-FO.............................................................................................6The Hype Behind XSL-FO................................................................................................6
Where Can XSL-FO Fit in Publishing Processing..........................................................7When You Have XML Content.........................................................................................7Making Pages from XML Content....................................................................................8XSL-FO Makes Print from XML......................................................................................8How XSL-FO Programs Get Created................................................................................9XSL-FO Creates Print (and Web) Output.........................................................................9XSL-FO Supports Big Batch Production........................................................................10Flowing XSL-FO into a Composition Engine.................................................................11
Aside: To Understand XSL-FO You Really Must Understand XSLT.........................11
What XSLT Does is Transform...................................................................................12The Very Basics of XSLT Transforms............................................................................12
How an XSLT Transform Works....................................................................................13
How XSL-FO Works........................................................................................................14XSL-FO is an XML Vocabulary (Tag Set).....................................................................15So an XSL-FO Document is............................................................................................15XSLT (Transforming) Builds XSL-FO-tagged Files.......................................................15
How XSL_FO Formatting Works...................................................................................16The Complete XSL-FO Picture.......................................................................................16Role of the XSL-FO Engine............................................................................................17
How Using XSL-FO Compares to Using HTML........................................................18
Features of XSL-FO Formatting..................................................................................22XSL-FO Designed to Deal with Typesetting Complexity............................................22XSL-FOs Page Model.................................................................................................23XSL-FO Uses Typographic Terminology....................................................................23XSL-FO Usually Created by Transformation...............................................................24XSL-FO Formatting Flows from the XML..................................................................24Internationalization and Accessibility..........................................................................25
XSL-FO Works Through Stylesheets..........................................................................25
The XSL-FO Big Picture..............................................................................................26All XSL-FO Programs Start with Page Design............................................................26Human Page Design is Translated into XSL-FO Formatting Objects..........................27
Examples of Formatting Objects..................................................................................28There are Block-type FOs and Inline FOs....................................................................29
Components of an XSL-FO Document.....................................................................29Page Descriptions (Layouts).....................................................................................30Multiple Page Masters...............................................................................................30XSL-FO Page Terminology.......................................................................................31Content Rectangle.....................................................................................................32Geometry of Regions Inside the Content Rectangle.................................................32
Technical Note: Regions...........................................................................................33
Page i
8/4/2019 Intro2XSL-FO
4/73
Introduction to XSL-FO Concepts
Where the Content Goes...........................................................................................34Page Sequences.........................................................................................................35Content Formatting Happens Inside the Flow...........................................................36
More Complex Pagination........................................................................................36Organization of a Typical XSL-FO Document.........................................................37 Blocks Take Typographic Properties.......................................................................38
Block Properties are Attributes of the Element................................38The Actual Text goesInside the Block......................................................................39
Lets Watch a Stylesheet Grow....................................................................................39 Whos Using XSL-FO and What is It Good For........................................................50
XSL-FO Software Vendors Name Their Clients.............................................................50Companies are Using XSL-FO When.............................................................................51XSL-FO Really Shines When.........................................................................................52Candidates also Include..................................................................................................53
Why Isnt Everybody Using XSL-FO?........................................................................53When XSL-FO Is Not Useful.......................................................................................54Really Bad XSL-FO Candidates Include......................................................................54You MightNotWant XSL-FO If.............................................................................55
Additional Planning Challenges......................................................................................55
XSL-FO Tools...................................................................................................................56Free XSL-FO Formatting Engines..................................................................................56Commercial XSL-FO Formatting Engines......................................................................57Page-layout Applications that Understand XSL-FO.......................................................57More Support Tools All the Time...................................................................................58There are Software Limitations.......................................................................................59XSL-FO Spec Sets Levels of Conformance....................................................................60
The Wrapup What Does It Take to Create XSL-FO.........................................................................61
What You Need to Know to Write an XSL-FO Stylesheet..........................................61What Does It Take toMaintain an XSL-FO Stylesheet...............................................62How do You Train an XSL-FO Programmer...............................................................62
There is Other Cool XSL-FO Material............................................................................63
The Hype Behind XSL-FO..............................................................................................63Some Real XSL-FO-Made Pages....................................................................................64
Information Resources: Where to Learn More.............................................................65Books..............................................................................................................................65Articles and Reports............................................................................................................
Online Resources............................................................................................................66XSL-FO Stylesheets Online............................................................................................66For Programmers.............................................................................................................67
Colophon............................................................................................................................68
Appendix
Appendix 1: The Most Basic Formatting Properties....................................................69
Page ii
8/4/2019 Intro2XSL-FO
5/73
Introduction to XSL-FO Concepts
slide 1
Administrivia
C Start, end, break
C How this will work
C Questions are always in order
C Who we am
C Anything else?
slide 2
Where We Are NotGoing in This Talk
(this is concepts not syntax)
C Details of XSL-FO syntax
C How to write an XSL-FO program
C How to design pages for XSL-FO
C How to solve your business problems
C
Particular XSL-FO toolsC specific features
C compliance
C recommendations
Page 1
8/4/2019 Intro2XSL-FO
6/73
Introduction to XSL-FO Concepts
slide 3
Where We Are Going Today?
Conceptual XSL-FO
C What XSL-FO is and what it is good for
C How XSL-FO works (system overview)
C What XSL-FO specifies (stylesheet overview)
C Whos using XSL-FO (and what its good for)
C Brief overview of some XSL-FO Tools
C Why everyone isnt using XSL-FO (when not to use)
C What it takes to use XSL-FO
C Looking at some real pages
slide 4
Warning: We are Going to Show Code
C But not much, this is concepts (how and why)
C You will understand the class even if you do not understand the code
C Dont panic if code is too heavy
C Sorry if you wanted to learn to write XSL-FO from this course
Page 2
8/4/2019 Intro2XSL-FO
7/73
Introduction to XSL-FO Concepts
slide 5
A Quick Poll (Who You Are)
C Where in the pipeline
C content creators / publishers
C prepress / composition
C printers
C print / web / graphic design
C fulfillment / distribution
C System analysts / application programmers
C Training
C What kind of publishing
C Books (monographs, reference series, etc.)
C Journals
C Magazines and newspapers
C Product documentation
C Technical documentation
CCourse materials (CBT, course-packages, tests, textbooks plus, etc.)
Page 3
8/4/2019 Intro2XSL-FO
8/73
Introduction to XSL-FO Concepts
slide 6
Do You Work with or Know
C HTML
C XML
C SGML
C PDF
C InDesign, QuarkXPress, other desktop publishing packages
C Microsoft Word
C High-powered composition systems (Miles 33, Penta, 3B2,
DataLogics)
C Preflighting software
C Workflow software
slide 7
What is XSL-FO
Extensible Stylesheet Language-Formatting Objects
C A way to make print directly from XML
C A page description language (that particular software can read)
C XSL-FO rendering software
C takes XML as input
C gives PDF, Postscript (RTF, MIF, etc.) as output
C Described in a W3C recommendation called XSL
(Extensible Stylesheet Language)
(Not new, recommendation since 2001)
Page 4
8/4/2019 Intro2XSL-FO
9/73
Introduction to XSL-FO Concepts
slide 8
Design Goals for XSL Formatting
C Allow designers to express how structured (XML) content
should be presentedC In print (pamphlet, magazine, bound volume, poster...)
C On screen
C In other media such as audio or braille
(without being tied to a particular application/vendor)
slide 9
The XSL Specification
C XSL specification is in two parts
C XSLT (the transformation part)
C XSL-FO (styling and pages)
C XSL specifies an XML tagset (what we call XSL-FO)
C says how to put content on the page
C describes page geometryinto which XML documents may be transformed (using XSLT)
Page 5
8/4/2019 Intro2XSL-FO
10/73
Introduction to XSL-FO Concepts
slide 10
The Dream Behind XSL-FO
C XML separates specification of format from content
C XML will specify the content(list, product name, paragraph, surname)
C XSL-FO will specify the layout, pagination, styles
C Goal: high-quality, high-volume, content-driven publishing
C Batch processing on one file or many
C Formatting is content-driven (from the XML tags)
C Definition of layout and styles
C Not bound to any platform
C Not proprietary to any software
slide 11
The Hype Behind XSL-FO
(mostly myth, well explain)
C Specify your pages once and make many outputs
(PDF, Postscript, web, audio)
C Publish lights-out, no human necessary
C All pagination systems will accept XSL-FO input
C These pages arejust as good as fine typesetting
C These pages are good enough
C Cheaper, faster, better
Page 6
8/4/2019 Intro2XSL-FO
11/73
Introduction to XSL-FO Concepts
slide 12
Where Can XSL-FO Fit in Publishing Processing
Currently, many print pages get made once
C using desk top publishing systems (InDesign, QuarkXPress)
C using high-end composition systems
C using graphics editors (Photoshop)
C in a word processor (then make PDF)
C in a web design tool (Dreamweaver)
slide 13
When You Have XML Content
C Content is reusable/repurposeable/customizable/personalizable/
internationalizable/localizable
C XML for single source publishing:
C XML transform HTML
C same XML high-end composition book
C same XML desktop publishing journal and magazine
C same XML transform RSS and ATOM syndication
C same XML archive/depository/database
Page 7
8/4/2019 Intro2XSL-FO
12/73
8/4/2019 Intro2XSL-FO
13/73
Introduction to XSL-FO Concepts
slide 16
How XSL-FO Programs Get Created
C You could write XSL-FO code by hand but
C it was not designed for that
C nobody does
C You could use a GUI tool to
C drag and drop your wishes
C writes XSL-FO behind the scenes
C But XSL-FO is typically made using XSLT
C which is an XML transformer
C changes your XML tags to
C XSL-FO tags with your content inside them
slide 17
XSL-FO Creates Print (and Web) Output
Page 9
8/4/2019 Intro2XSL-FO
14/73
Introduction to XSL-FO Concepts
slide 18
XSL-FO Supports Big Batch Production
C Write instructions once, run on many files
C Hands-free page make-up
C Consistency of generated content
C Format complex documents in seconds
C Run unattended to make consecutive output files
C Save typesetter time on routine tasks
(some pesky handwork replaced by work for the software)
slide 19
Lot of XSL-FO Processing is Batch Mode
C Run XML to pages (according to stylesheet)
C Look at output (PDF, etc.)
C as printed pages
C using online viewer
C For formatting you dont like (bad widow, graphic placement)
C alter the XML document
C run again
C alter the XML document
C run again
C alter...
Page 10
8/4/2019 Intro2XSL-FO
15/73
Introduction to XSL-FO Concepts
slide 20
Flowing XSL-FO into a Composition Engine
(May be the best of both worlds)
C Run XSL-FO stylesheet making formatting objects
C Open results in a composition engine
C Change XML and reflow if content changes
C Make non-content tweaks inside the composition system
C Graphics placement
C Column balancing
C Floats, keeps, widow, orphans
C You get both
C clean validatable (XML ) input and batch processing and
C ability to tweak pages by hand
(There are composition systems that accept XSL-FO input)
slide 21
Aside: To Understand XSL-FOYou Really Must Understand XSLT
Extensible Stylesheet Language Transformation
(Since most XSL-FO is created via XSLT)
C The XML Transformation Language
C Provides transformation and manipulation functions for XML files
C Designed to make XML into something else (HTML, different XML,etc.)
C A W3C Recommendation (original 1999)
Page 11
8/4/2019 Intro2XSL-FO
16/73
Introduction to XSL-FO Concepts
slide 22
What XSLT Does is Transform
Transform means change
C Reads XML documents and writes something else
C HTML for browsers
C a different XML tag set
C typesetting driver file (InDesign, QuarkXPress, FrameMaker)
C interchange file (RTF, RDF, EDI, etc.)
C a flat ASCII file (plain text, comma separated etc.)
C an XSL-FO document (input to formatting process)
slide 23
The Very Basics of XSLT Transforms
C Transform
C Does notchange the input file
C Creates one (or more) new output files
C Does notmake non-XML into XML
C Two basic requirements
C known XML source (tag set, schema, DTD)
C known target (such as HTML or XSL-FO)
Page 12
8/4/2019 Intro2XSL-FO
17/73
Introduction to XSL-FO Concepts
slide 24
How an XSLT Transform Works
C Reads XML document(s) (tags and text)
C Uses an XSLT stylesheet/transform (a program)
C Runs using XSLT processing software (called an XSLT Engine)
C Produces output document(s)
(this output file could be an XSL-FO file)
slide 25
Read an XML document
Sasparilla
Usdin
Deputy in Charge of Chewables
Mulberry Technologies
RockvilleMD20850sassy
3670
Page 13
St ruct ure of an XSLT Syst em
XSLTst ylesheet
XSLTprocessor
out putfile
XMLfile
8/4/2019 Intro2XSL-FO
18/73
Introduction to XSL-FO Concepts
slide 26
Transform It into HTML
slide 27
How XSL-FO Works
C XSL-FO is an XML tag set
C XSLT is the middle of XSL-FO
(how you make XSL-FO from XML)
C How XSL-FO engines work
C Architecture of an XSL-FO system
Page 14
8/4/2019 Intro2XSL-FO
19/73
Introduction to XSL-FO Concepts
slide 28
XSL-FO is an XML Vocabulary (Tag Set)
C XSL-FO vocabulary is a set of tags that describe:
C the layout geometry of a page(into which you pour content)
C a set of formatting objects:
C that say how to put content on the pages
C that describe how the document should be rendered
slide 29
So an XSL-FO Document is
C An XML document
C Tagged in the XSL-FO tag set
C That contains your text and graphic content
wrapped in formatting object tags (F - O, get it?)
slide 30
XSLT (Transforming) Builds XSL-FO-tagged Files
C Start with your XML file (tags and text)
C Use XSLT to transform from
C original XML tags (, , ) into
C XSL-FO tags (, ,
)
Then XSL-FO software makes pages from those XSL-FO tags
Page 15
8/4/2019 Intro2XSL-FO
20/73
Introduction to XSL-FO Concepts
slide 31
How XSL_FO Formatting Works
slide 32
The Complete XSL-FO Picture
In XSL-FO processing
C Tags and content in an XML document
C Are transformed
C from their XML tags
C into XSL-FO tags
C which describe the styling
C and hold the content
C XSL-FO rendering engine
Cunderstands these tags
C makes pages from them (PDF, Postscript, RTF, etc.)
C And printed/displayed using a display engine
(like Adobe Acrobat for the PDF or Word for the RTF)
Page 16
8/4/2019 Intro2XSL-FO
21/73
Introduction to XSL-FO Concepts
slide 33
XML is Turned into FO-XML is Turned into Pages
slide 34
Role of the XSL-FO Engine
C
Understands the XSL-FO vocabulary
C Produces display for paper (we dont know/care how)
C An XSL-FO programmer needs to know
which XSL-FO tags to use to make the pages he/she wants
Page 17
8/4/2019 Intro2XSL-FO
22/73
Introduction to XSL-FO Concepts
slide 35
How Using XSL-FO Compares to Using HTML
HTML is one way to display XML
C HTML is a vocabulary of tags into which XML can be translated
C HTML software (a browser) makes the display from those tags
C We know the vocabulary to make the screen effect we want
...
Wow!
...
(Native HTML does not enable complex page layout, multiple columns,running heads, keeps and breaks)
slide 36
Using HTML to Make a Display
(we make HTML; browser makes display)
Page 18
8/4/2019 Intro2XSL-FO
23/73
Introduction to XSL-FO Concepts
slide 37
HTML Example
C Start with XML-tagged source
Waffles with Syrup
...
C Use XSLT to transform that XML into HTML source
Waffles with Syrup
C And the browser (like IE or Firefox) understands
the HTML tags () and displays
Page 19
8/4/2019 Intro2XSL-FO
24/73
Introduction to XSL-FO Concepts
slide 38
XSL-FO is Another Way to Display XML
C XSL-FO is a vocabulary of tags into which XML can be translated
C XSL-FO software (a rendering engine) makes the displayfrom those tags
C We know the vocabulary to make the print effect we want
...
Wow!
...
(XSL-FO can describe more complex, sophisticated page layouts thanHTML)
slide 39
Using XSL-FO to Make a Display
(typically a PDF page)
Page 20
8/4/2019 Intro2XSL-FO
25/73
Introduction to XSL-FO Concepts
slide 40
XSL-FO Example
(one more step than in the HTML)
C The source XML
Waffles with Syrup
...
C Use XSLT to transform that XML into
Waffles with Syrup
C Rendering software understands the XSL-FO tags and creates PDF
C And the display engine (like Acrobat) understands the PDF and
displays
Page 21
8/4/2019 Intro2XSL-FO
26/73
Introduction to XSL-FO Concepts
slide 41
Features of XSL-FO Formatting
C XSL-FO
C is a typesetting application
C has a complex, extensible Page Model (multicolumn)
C has sophisticated text typography (hanging indents, multi-font)
C uses typographic concepts and terminology
C XSL-FO usually created by transformation
C Formatting is based on XML tagging
C Internationalization designed in
slide 42
XSL-FO Designed to Deal with Typesetting Complexity
C Multiple columns
C Endnotes and footnotes
C Block-level behaviors (leading, margins, padding, space before/after)
C Text-level behaviors (font family, style, weight, size, color)
C Hyphenation and justification
C Marginalia
C Rules and leaders
C Page markers and links
C Autogenerated cross-references, Tables of Contents, indexes
Page 22
8/4/2019 Intro2XSL-FO
27/73
Introduction to XSL-FO Concepts
slide 43
XSL-FOs Page Model
C XSL-FO describes page layout
C page size
C margins and columns and gutters
C headers and footers
C side-bars, etc
C Can describe sequences of different page layout templates
C First page followed by later pages
C Recto/verso alternating
slide 44
XSL-FO Uses Typographic Terminology
and frequently Cascading Stylesheet (CSS) names
C The XSL-FO spec and XSL-FO stylesheets talk about
C floats and keeps
C blocks and inline
C masters and sequences
C font, point-size, leading, font-weight, serif, cursive
C margins, leading, line-height, padding
C You need to know some typography to
write XSLT/XSL-FO stylesheets (at least the terminology)
Page 23
8/4/2019 Intro2XSL-FO
28/73
Introduction to XSL-FO Concepts
slide 45
XSL-FO Usually Created by Transformation
C XSL-FO is typically made by XSLT
C XSLT is a transformer (changing source tags to XSL-FO tags)
C Since youre transform anyway, take advantage
C Rearrange the order of the XML
C Delete things from the XML
C Duplicate things in the XML
C Add things to the XML
C Select only the parts you want for publication
slide 46
XSL-FO Formatting Flows from the XML
In XSL-FO, you can make formatting distinctions based on
C Element type
C Attribute value
C Element or attribute content
(s containing Introduction)
C Many more refined tests
C Element position
(first, last, nth member of a )
C Element context
(chapter title, figure title, table title)
CGrouping elements (lists versus items in the list)
Page 24
8/4/2019 Intro2XSL-FO
29/73
Introduction to XSL-FO Concepts
slide 47
Internationalization and Accessibility
C XML character set is internationalized (Unicode)
C XSL-FO supports non-Western writing directions
C Writing mode describes layout and direction of writing, e.g.
C Left-to-right-top-to-bottom ( lr-tb)
C Top-to-bottom-right-to-left ( tb-rl)
C Relative frame of reference
(not top, bottom, left and right butbefore, after, start and end)
C
Formatting properties for audio media
slide 48
XSL-FO Works Through Stylesheets
C A stylesheet is a computer program
C Before programming
C
start with designC design is still king
C The program itself (a transformation)
C Page geometry
C Formatting Objects (what and how)
C Where does the content go anyway?
Page 25
8/4/2019 Intro2XSL-FO
30/73
Introduction to XSL-FO Concepts
slide 49
The XSL-FO Big Picture
(format-specification, transforming, and rendering are separate
steps)C This whole thing works because
C there is software (XSL-FO Rendering Engines)
C hard-wired to understand XSL-FO tags
C which uses those tags to make pages
C XSL-FO tags describe (in a system-independent way)
C text formatting objects with styling
C page geometry
C And there is a transform (XSLT) to turn your XML tags into XSL-FO
tags
XSL-FO is the intermediate form between media-neutral XMLand media-dependent output - Stephen Deach
slide 50
All XSL-FO Programs Start with Page Design
(all typesetting does)
C Page layout(s) must be designed
C first page/recto/verso pages
C headers and footers
C Whitespace and margins
C Text typography must be designed
C fonts
C text size and leading
C title design and indents
C This is still a people process!
Be prepared to accept small tweaks in your original design (minor XSL-FO or engine limitations
Page 26
8/4/2019 Intro2XSL-FO
31/73
Introduction to XSL-FO Concepts
slide 51
Human Page Design is Translated intoXSL-FO Formatting Objects
C
Formatting Objects Describe Page LayoutC page size
C margins, columns
C headers, footers, side-bars. etc.
C Different page layout templates (masters) can be sequenced, e.g.
C first page followed by later pages
C recto / verso alternating
C Formatting Object with their properties control
C text placement
C fonts, sizes, line height, leading
C hyphenation, widows / orphans, etc.
slide 52
So What is a Formatting Object?
C An XML element
C With properties that are XML attributes
Page 27
8/4/2019 Intro2XSL-FO
32/73
Introduction to XSL-FO Concepts
slide 53
Examples of Formatting Objects
TYPE OF
FORMATTINGOBJECT
DESCRIPTION SAMPLE TAGS
Inline-level FOs These things are in the same lineas the things around them, they donot add new structure or changewriting direction, think emphasis,leader dots, font families and size
Block-level FOs Things that are separate from thethings around them, not runin.Blocks include paragraphs, titles,and block quotes. Blocks stack onetop of each other (or below eachother) like childrens blocks.
FOs for Lists Lists are complex block-typeobjects, typically composed of listitems, which are typicallycomposed of some sort of prefixcharacter (like a bullet, number,letter which XSL calls a label) andthen the body of the list item.
FOs for Tables Rows and columns are different
from simple blocks; and thereforehave their own special FOs
Pages and LayoutObjects
Top-level elements that definewhat the page(s) will look like andgive you page sequences likemaking recto and verso pages
different
Out of Line FOs(includes links)
FOs for footnotes and marginalia,stuff not in the regular stream oftext
(There are other objects such as graphics and floats)
Page 28
8/4/2019 Intro2XSL-FO
33/73
Introduction to XSL-FO Concepts
slide 54
There are Block-type FOs and Inline FOs
C Almost everything is a simple block or an inline
C Lists and tables are blocks with special behaviours
slide 55
Components of an XSL-FO Document
(the, usually virtual, documents made during the transform)
An XSL-FO document has two major parts
C Both parts are enclosed in a top-level element
C Part One contains page descriptions (layouts and page masters)
C general layout of each potential page
C instructions to the rendering engine on which page templates
to use when
C inside element
C Part Two contains page sequences (content flows)
C assign content to pages
C assign formatting styles (properties) to content
C inside one or more elements
Page 29
8/4/2019 Intro2XSL-FO
34/73
Introduction to XSL-FO Concepts
slide 56
Page Descriptions (Layouts)
(There will be sets of these)
C Describe dimensions and aspects of one page
C in print, this is a single print page (8 by 11, A4, etc.)
C for web design these can be BIG pages with scrollable regions
(HTML-style page)
C Provides
C A name, so we can send content to that named page-design
C page width
C page margins
C dimensions of page regions
C Inside element
slide 57
Multiple Page Masters
C You can have more than one
C with different identifiers
C Useful if you have regular sequences of page layouts
C E.g., chapter first page followed by alternative left and right hand
pages
Page 30
8/4/2019 Intro2XSL-FO
35/73
Introduction to XSL-FO Concepts
slide 58
XSL-FO Page Terminology
C Pages have a height and width, plus four margins
(top, bottom, left, right)C How these properties map to page depends on writing mode and
orientation
Graphic from the XSL CR 21 November 2000, 6.4.12
Page 31
8/4/2019 Intro2XSL-FO
36/73
Introduction to XSL-FO Concepts
slide 59
Content Rectangle
C Is the area where the text will actually go. That includes:
C not just the body text with
C columns and gutters, but also
C headers and footers
C Is divided into regions
C Regions have names and text can be placed into regions
(Not just the body text, this is the whole print region)
slide 60
Geometry of Regions Inside the Content Rectangle
C Content area contains five region-viewport-areas
C These are set inside the page in the space between the page margins
C Provide space for
C any content flows (such as paragraphs) or
C static content(such as headers or footers)
Graphic from the XSL CR 21 November 2000, 6.4.12
Page 32
8/4/2019 Intro2XSL-FO
37/73
Introduction to XSL-FO Concepts
slide 61
Technical Note: Regions
C Regions can overlap, based on
C size they are defined to be (extent)
C margin of neighboring region
C amount of overlap = extent - margin
C Whether text will overflow or be scrolled, clipped, etc., can also be
controlled through properties
C The region-bodyregion (but not other regions) may contain columns
C Depending on orientation
(for vertical Japanese, right-to-left Hebrew, etc.)
Ctop may become left
C right become top, etc.
Page 33
8/4/2019 Intro2XSL-FO
38/73
Introduction to XSL-FO Concepts
slide 62
Up to This Point
C We have described pages and pages geometry
C Put page layout is only half the story
C Where is the text, the content?
C Where does the content go?
slide 63
Where the Content Goes
C Thats the second half of the stylesheet (program)
C Content goes into Page Sequences
C is a wrapper element for content
C As Dave Pawson expressed it
The page-sequence element contains the content to fill a
sequence of pages
C Page sequences contain Formatting Objects such as s
Page 34
8/4/2019 Intro2XSL-FO
39/73
Introduction to XSL-FO Concepts
slide 64
Page Sequences
C Contain
C static content(the same on every page)
C for headers and footers (page numbers)
C name the region they will go into
C aflow
C the primary stream of content
(goes from page to page)
C contains block-level formatting objects (e.g. )
C these objects will flow onto the page(through the page sequence)
C names the region into which content will be flowed
Page 35
8/4/2019 Intro2XSL-FO
40/73
Introduction to XSL-FO Concepts
slide 65
Content Formatting Happens Inside the Flow
C Various Formatting Objects are placed inside the flow...
C Usually blocks
C Blocks are used to format simple structures
C Paragraphs
C Titles
C Lines
C Captions
C Display quotes
C Section heads, etc. etc.
C Other Formatting Objects are available for more complex structures
(lists, tables, footnotes, etc. are more complex)
slide 66
More Complex Pagination
C Point to page-masters (so you know what kind of page gets the
content)C Used for
C recto/verso differences
C first page different from all others
C intentionally blank pages have no header or footer
C In other words: to vary which page masters get chosen when
C Inside the element
C Technically
C specify a sequence ofs
C that are used for a given (to flow content)
Page 36
8/4/2019 Intro2XSL-FO
41/73
Introduction to XSL-FO Concepts
slide 67
Organization of a Typical XSL-FO Document
Page 37
8/4/2019 Intro2XSL-FO
42/73
Introduction to XSL-FO Concepts
slide 68
Blocks Take Typographic Properties
(simplified)
Blocks define the way the text will look through properties
C Font
font-family, font-size, font-weight
C Color
color, background-color
C Spacing
space-before, space-after
C Line height
C Indents and margins
Blocks may be nested, and inherit properties from ancestors.
slide 69
Block Properties are Attributes of the Element
Hello, World!
Page 38
8/4/2019 Intro2XSL-FO
43/73
Introduction to XSL-FO Concepts
slide 70
The Actual Text goes Inside the Block
C This XML
Carrots with Ginger Sauce...
C Might be put inside a block like this
Carrots with
Ginger Sauce
slide 71
Lets Watch a Stylesheet Grow
See the formatting of a recipe (or 1000 recipes) spring into shape:
1. Basic page, undifferentiated text
2. Main blocks of content separated
3. Inline elements formatted
4. Ingredients as a table
5. Directions as a list
6. Levels of title distinguished
Page 39
8/4/2019 Intro2XSL-FO
44/73
Introduction to XSL-FO Concepts
slide 72
The XML We Started From
Fancy Apple Pie
dessert pie
apple
The Pastry
1 1/2
c
flour
1/2
tsp
salt
1/2
c
unsalted butter, cold
1
tsp
sugar
3-4
Tbsp
cold water
flour (for sprinkling)
Make the pie crust in your usual
way. Bake blind 14 min at 400F.
Page 40
8/4/2019 Intro2XSL-FO
45/73
Introduction to XSL-FO Concepts
The Filling
4
tart apples, peeled
1
Tbsp
lemon juice
2
Tbsp
unsalted butter
2/3
c
sugar
3
eggs
1
c
heavy cream
pinch
nutmeg
pinch
cinnamon
Page 41
8/4/2019 Intro2XSL-FO
46/73
Introduction to XSL-FO Concepts
Grate the apples, and sprinkle with lemon
juice to prevent browning.
Cook the apples and sugar gently in the
butter just to boiling. Simmer until the apples
are soft and little liquid remains. Cool.
Beat the eggs. Beat in the cream, nutmeg,
and cinnamon. Mix in the apples and pour the
mixture into the pie shell.
Bake until the custard is just set, a
bout 30 min.
Adapted from Angela.
Serves 6
...
Page 42
8/4/2019 Intro2XSL-FO
47/73
Introduction to XSL-FO Concepts
slide 73
Here is the Unformatted Text Poured onto a Page
Page 43
8/4/2019 Intro2XSL-FO
48/73
Introduction to XSL-FO Concepts
slide 74
First, Make Some Block Objects
Page 44
8/4/2019 Intro2XSL-FO
49/73
Introduction to XSL-FO Concepts
slide 75
Add Formatting for the Inline Objects
Page 45
8/4/2019 Intro2XSL-FO
50/73
Introduction to XSL-FO Concepts
slide 76
Make the Ingredients List into a Table
Page 46
8/4/2019 Intro2XSL-FO
51/73
Introduction to XSL-FO Concepts
slide 77
Display the Steps as a List
Page 47
8/4/2019 Intro2XSL-FO
52/73
Introduction to XSL-FO Concepts
slide 78
Distinguish Among Different Levels of Title
Page 48
8/4/2019 Intro2XSL-FO
53/73
Introduction to XSL-FO Concepts
slide 79
Now Make It Prettier
the stylesheet writer could
C Add rules
C Add graphics
C Play with fonts
C Make it the design your designer dreamed up
Page 49
8/4/2019 Intro2XSL-FO
54/73
Introduction to XSL-FO Concepts
slide 80
Whos Using XSL-FO andWhat is It Good For
C
Whos using XSL-FO now?C What do they gain?
C When does XSL-FO not make sense?
C Why isnt everyone using XSL-FO?
C When does XSL-FO make very good sense?
slide 81
XSL-FO Software Vendors Name Their Clients
(small random sample)
Visa International Bank of America Mastercard
European CustomsUnion
Pratt & Whitney Nike Customer ServiceCenter
Bell South TransCanada Pipelines Limited SAS
Cisco Siemens AG Semantec
Credit Swiss Hewlett-Packard State of Oregon (legislature)
Princess Cruise Lines State of Iowa Motor Vehicles Intermountain Gas Company
ConnXion Minneapolis Public Schools Boeing
SAP Ami Airbus
Lockheed Martin HSBC Network Appliances
Page 50
8/4/2019 Intro2XSL-FO
55/73
Introduction to XSL-FO Concepts
slide 82
What the Commercial XSL-FO Vendors Claim
C They can do 70-85% of traditional high-end composition
C 2002 XSL-FO could probably meet 30-40% of publishing needs
C 2005 8085% (they will claim higher)
C That their clients have modified their [formatting] requirements to
enable them to live with the [XSL-FO] limitations
slide 83
Companies are Using XSL-FO WhenThey want advantages of XML and
C Speed is more important than extreme quality
C High-end composition is too expensive
C Volume is too large for speed of human layout
C Need batch pagination (multitudinous documents pulled from a
database and poured into templates)
C
Output process has to be automated (lights out)C Need fast proofs, before conventional page-layout (WYSIROTS)
Page 51
8/4/2019 Intro2XSL-FO
56/73
Introduction to XSL-FO Concepts
slide 84
XSL-FO Really Shines When
C Speed of production is critical (so many transactions that if people
intervene it could not be run in real time) (credit card statements)C Large volume of similar documents
C All (or most) layout decisions can be stated as rules
C People checking the final output does not add value (bank statements)
C Document format is easily repeatable
C Content can be validated before processing
C Multilingual content that changes writing direction frequently
slide 85
Ideal XSL-FO Candidates
(XSL-FO is a Great Report-writer)C Content-driven document
C Format on-demand for a customer
C In large batches
C For exampleC credit card and bank statements
C catalogs, directories, indexes, listings
C bank statements
C insurance policies and claims
C contracts
C legal agreements
C investment portfolios
C telephone books
C hospital systems reports
C patient medical charts
Page 52
8/4/2019 Intro2XSL-FO
57/73
Introduction to XSL-FO Concepts
slide 86
Candidates also Include
(Its Not Just For Reports)
C Bills, resolutions, reports of state legislatures
C Journal articles and other short materials
C Textbooks
C where there is page after page of tight textual material
C where the same basic content (and ancillary products) varies state by
state
C Books with regional variations
C Manuals (software, owner, maintenances)
C Reference books
slide 87
Why Isnt Everybody Using XSL-FO?
By design, XSL-FO is desk-top publishing, not fine typography
C XSL-FO spec doesnt express all of typography
C XSL-FO engines may only produce desktop quality (or less)
C quality of H&J
C page layout and vertical justification
C floats, keeps, widows, and orphans still a little weak
(improving every year)
C no CMYK, few pantones
Page 53
8/4/2019 Intro2XSL-FO
58/73
Introduction to XSL-FO Concepts
slide 88
When XSL-FO Is Not Useful
C Your content is not in XML, and is not likely to be
C Layout designers add value spread-by-spread(WiredMagazine, picture books)
C Your formatting requirements arent supported by:
C the XSL-FO vocabulary
C an existing XSL-FO engine (e.g., support for massive tables varies)
C your tagging
(last bullet is the Achilles heel of XSL-FO [or any other] automation
the computer cant know what you dont tell it)
slide 89
Really Bad XSL-FO Candidates Include
C Any content where page design does not flow from the tagging
C Grade school math texts (every spread is individual layout art)
C
High-design magazinesC Most advertising circulars
C Material that is art not mass production
C Fancy newspaper layout with multiple continuations
C One-off broadsheets
Page 54
8/4/2019 Intro2XSL-FO
59/73
Introduction to XSL-FO Concepts
slide 90
You Might NotWant XSL-FO If
C Content is well-formed XML with no DTD or schema
(too much variation; too many surprises)C Page-limited productions, where text will be altered to fit the space
C Most text changes are made afterlayout
(Unless you are flowing your FO into an interactive tool that lets youtweak)
C DTD or schema changes constantly
(XSL-FO stylesheet would need constant modification to keep up)
C Content is highly variable in structure
(structure has loads of options)
slide 91
Additional Planning Challenges
C Solely or mostly hands-off process doesnt suit every layout
C Writing typographic instructions for a computer to perform is
C
very different than doing the layoutC very different from making a mockup or naming Quark styles
C a logic task (programmer) not a graphic design task
C You need both a typographic designer and a programmer
(rarely the same person)
C Desktoppers trained on applications (QuarkXPress, Photoshop)
not in typography
Page 55
8/4/2019 Intro2XSL-FO
60/73
Introduction to XSL-FO Concepts
slide 92
XSL-FO Tools
C Rendering engines
C XSL-FO editors
C Online previewers
C Composition systems that accept XSL-FO input
C Two cost categories
C free and open source
C commercial
slide 93
Free XSL-FO Formatting Engines
(representative stand-alone, free command-line engines)
C FOP
C an Apache project
C built into several XML editing applications, e.g., Oxygen, TopXML,
Editix
C Suns xmlroff. Open-source.
C IBMs XFC (XSL Formatting Objects Composer)
C SourceForges jFor project
C Unicorn Formatting Objects: C++ application that makes TeX
C Chive Apoc XSL-FO renderer (a full port of FOP for .NET)
Page 56
8/4/2019 Intro2XSL-FO
61/73
Introduction to XSL-FO Concepts
slide 94
Commercial XSL-FO Formatting Engines
(representative commercial GUI software)
C AntennaHouse XSL Formatter(plugins for XMLSPY, others in the works)
C RenderX XEP Rendering Engine
(built into XSLFast, which can produce as PDF or deliver to InDesign,QuarkXPress, FrameMaker)
C Scriptura and Scripturaxbos
C Ibex
C
Ecrion XF Rendering ServerC Xinc (Swing XSL-FO viewer)
slide 95
Page-layout Applications that Understand XSL-FO
(selected)
CArbortext 3b2-FO
C XyEnterprise XPP
C Arbortext Epic
C FrameMaker within Adobe Document Server
Page 57
8/4/2019 Intro2XSL-FO
62/73
Introduction to XSL-FO Concepts
slide 96
More Support Tools All the Time
C DTD-specific XSL-FO application for NewsML/NITF
C RTF to XML or to XML + XSL-FO
C HTML to XSL-FO
C CSS to XSL-FO
C HTML to PDF (using FOP)
C Microsoft Words HTML or their XML to XSL-FO
C Document servers from Saffron, Adobe
C ebXML/UBXML stylesheet generators
slide 97
You Get What You Pay For
C Commercial engines
C are more powerful than free ones
C have better language/alphabet/hyphenation support
C have been built into editors and other products
C Free, shareware, and open source
C are still quite useful
C have been built into editors and other products
Page 58
8/4/2019 Intro2XSL-FO
63/73
Introduction to XSL-FO Concepts
slide 98
There are Software Limitations
C Different products have different strengths
C Nobody implements all of the very large XSL-FO spec
C Products add non-compatible, non-spec useful extensions
C XSL-FO stylesheets are not 100% interchangeable
C looks great from product A
C looks lousy from product B
C blows up in product C
C Support varies for
C forms and fill-in-the-blank
C equations (MathML or TeX or both)
C tables
C writing direction and hyphenation
Page 59
8/4/2019 Intro2XSL-FO
64/73
Introduction to XSL-FO Concepts
slide 99
XSL-FO Spec Sets Levels of Conformance
C Three Levels
C basic Minimum level of pagination or aural rendering
C extended Everything else for sophisticated pagination except
some conveniences
C complete Everything (Example: font-selection-strategy)
C Not as useful as they sound
C because there are parts nobody does
C so actual levels are really higher than reported levels
C Applications generally provide
C Basic conformance
C Some part of Extended conformance; and
C Conformance table
including any extensions
(Check with your vendor, read the conformance table, then ask their clients)
slide 100
Conformance Examples
(as of December 2005)
C XEP has not yet implemented table-omit-footer-at-break
C AntennaHouse has not yet implementedfont-selection-strategy
C fop has not yet implemented all of the Basic conformance items
C Almost no one had implemented any aural properties so far
(In general what they do have is more important than what they dont)
Page 60
8/4/2019 Intro2XSL-FO
65/73
Introduction to XSL-FO Concepts
The Wrapup
slide 101
What Does It Take to CreateXSL-FOC An XSL-FO engine (software purchase)
C Source documents in XML that need making into pages
C Designers (pages still need to look readable and pleasing)
C Programmers to write the XSLT/FO transforms (can be contracted out)
C Desire to change to an XML workflow
C get simple results very easily
C with work, can develop into something quite sophisticated
slide 102
What You Need to Know to Write an XSL-FO Stylesheet
C XML source tags (what are they, what do they mean)
C Target page design (look, behavior)
C The XSL-FO vocabulary (how to make the desired effects)
C Some XSLT, maybe quite a lot (how to do the transform)
C Relation between XML source and desired effects
(typically expressed as a specification, like a typesetting specification)
Page 61
8/4/2019 Intro2XSL-FO
66/73
Introduction to XSL-FO Concepts
slide 103
What Does It Take to Maintainan XSL-FO Stylesheet
(a lot less)C
Source documents in XMLC Changes you need to make to the formatting
C Knowledge of typography to accomplish those changes
C Enough XSLT to understandthe XSL-FO stylesheets
C Enough XSL-FO vocabulary to produce the changes
C An XSL-FO engine to run the new stuff
slide 104
How do You Train an XSL-FO Programmer
(Hint: It is more critical to know typesetting than programming)
C They must know XML and XSLT
C Download an evaluation XSL-FO engine (free for a while)
C Read any tutorials and examples that come with the engine
C Program something simple (not live data)
C Download the XSL spec from W3C and print it (its big!)
C Take a course (many available)
C Buy
C Michael Kays XSLT Programmers Reference
(and/or haunt Zvon)
C One of the XSL-FO books (for reference)
C Read some GOOD code (e.g., Ken Holmans UbXML stylesheets)
C Read the XSL list and XSL-FO lists and ask questions
* URLs for all the above are in the appendices
Page 62
8/4/2019 Intro2XSL-FO
67/73
Introduction to XSL-FO Concepts
slide 105
There is Other Cool XSL-FO Material
(no time to mention in 3 hours)C
XSL-FO plus SVG for dynamic web-publishingC XSL-FO for bar codes
C XSL-FO drives the screen display of an XML editing tool
C XSL-FO plays chess (or at least displays chess)
slide 106
The Hype Behind XSL-FO(lets re-examine those myths)
Specify your pages once and make many outputs(PDF, Postscript, web, audio all one stylesheet)
Not on my planet. You want lots ofdifferent stylesheets; not just one PDFbut many.
Publish lights-out, no human necessary. For many types of content, not all.
All pagination systems will accept XSL-FO input. Hasnt happened yet, but some do andmore all the time.
These pages arejust as good as fine typesetting. Wellno.
These pages are good enough. Quite possibly.
Cheaper, faster, better Probably, definitely, and (hey) twoout of three aint bad! Who definesbetter anyway?
Page 63
8/4/2019 Intro2XSL-FO
68/73
Introduction to XSL-FO Concepts
slide 107
Some Real XSL-FO-produced Pages
C Well show some made with XSL-FO to illustrate
C range
C complexity
C what we could find that was not behind fire walls
C If theres time well make some pages
Its fast and easy
slide 108
Some Real XSL-FO-Made Pages
C Conference papers, for example:http://www.idealliance.org/proceedings/xml05/ship/160/piez-
xml2005-ideadb.PDF (XSLT throughout the document lifecycle)
C Short PDF samples from RenderX, e.g., Color table in PDFhttp://xep.xattic.com/xep/testsuite/features/color.pdf
C Short PDF samples from Antennahouse, e.g., glyph orientationhttp://www.antennahouse.com/XSLsample/pdf-
v32/GlyphOrientation.pdf
Page 64
8/4/2019 Intro2XSL-FO
69/73
Introduction to XSL-FO Concepts
slide 109
Information Resources: Where to Learn More
slide 110
Books
C XSL Formatting Objects: Developers Handbook, Doug Lovell, 2002
C Elliotte Rusty Harold, chapter. 18 ofThe XML Biblehttp://www.cafeconleche.org/books/bible2/chapters/ch18.html
C XSL-FO: Making XML Look Good in Print, Dave Pawson, 2002
C Practical Formatting Using XSL-FO, Ken Holman
slide 111
Articles and Reports
C Gilbane Report: Overview article (Jan/2004)http://www.gilbane.com/gilbane_report.pl/94/XSLFO_Ready_for_Pr
ime_Time.html
C About.coms article on XSL-FOhttp://webdesign.about.com/cs/xslinformation/a/aaxslfo.htm
C 3Schools XSL-FO tutorialhttp://www.w3schools.com/xslfo/default.asp
C PerfectXML.com tutorial http://www.perfectxml.com/XSLFO.asp
C XML Pitstop's list of many articleshttp://www.xmlpitstop.com/ListResourcesByType/DispContentType/
XSL-FO/PageNumber/1.aspx
C W3C's XSL-FO resource page http://www.w3.org/Style/XSL/
C Antennahouse tutorial and examples
http://www.antennahouse.com/XSLsample/XSLsample.htm
C Ecrion tutorial http://www.ecrion.com/XF/TechnicalResources/XSL-FO%20Tutorial.aspx
C DevX article on using XSL-FO with Java servlethttp://www.devx.com/xml/Article/16430/1954?pf=true
Page 65
8/4/2019 Intro2XSL-FO
70/73
Introduction to XSL-FO Concepts
C Ibex tutorial on using Ibex with SQL Serverhttp://www.xmlpdf.com/ibex-sql.html
C XSL-FO Chefs Tool Exhibition
http://www.idealliance.org/proceedings/xml03/slides/xslfoshowcase
C What Is XSL-FO and When Should I Use It? (Seybold Report, Dec.
2002)http://www.adobe.com/products/server/documentserver/pdfs/adobeseybold_xsl-fo.pdf
slide 112
Online Resources
C W3C list of processors, with notes: http://www.w3.org/Style/XSL/
C Diderot Track XSL-FO list of processors, with notes and conformance
comparison table:http://www.diderottrack.nl/en.articles.xslfo.html
C XSL Info site http://www.xslfo.info/
C The lists:
C W3C mailing list http://lists.w3.org/Archives/Public/www-xsl-fo/
C XSL-List (XSLT and XSL-FO)http://www.mulberrytech.com/xsl/xsl-list/
C Yahoo XSL-FO group http://groups.yahoo.com/group/XSL-FO/
slide 113
XSL-FO Stylesheets Online
C AntennaHouse sample fileshttp://www.antennahouse.com/XSLsample/XSLsample.htm
C Docbookhttp://docbook.sourceforge.net/projects/xsl/; also a
book about Docbook XSL http://www.sagehill.net/book-description.html
Page 66
8/4/2019 Intro2XSL-FO
71/73
Introduction to XSL-FO Concepts
C DocBook stylesheet
Wikihttp://wiki.docbook.org/topic/DocBookXslStylesheets
C RenderX FO-features demonstration with the XSL-FO stylesheetshttp://www.renderx.com/featurestest.html
C
AntennaHouse WordMLtoFO stylesheet ($980)http://www.antennahouse.com/product/wordmltofo.htm
C Crane Softwrights XSL-FO for UBLhttp://www.cranesoftwrights.com/resources/ublss/
C Microsoft/RenderX XSL-FO files for converting WordML to XSL-FOhttp://msdn.microsoft.com/office/default.aspx?pull=/library/en
-us/odc_wd2003_ta/html/OfficeWordWordMLtoXSL-FO.asp
slide 114
For Programmers
C FAQs and Specs
C News, examples, software links, and book links at xslfo.infohttp://www.xslfo.info/
C ZVON XSL-FO Reference (indexed to the Rec)http://www.zvon.org/xxl/xslfoReference/Output/
C The XSL-FO Recommendation http://www.w3.org/TR/xsl/
C
Dave Pawsons XSL-FO QA snippetshttp://www.dpawson.co.uk/xsl/sect3/index.html
C Instructions for installing two free XSL-FO processors, FOP and
PassiveTeX:http://www.sagehill.net/docbookxsl/InstallingAnFO.html
C ListServs to ask Questions
C XSL-List (XSLT and XSL-FO)http://www.mulberrytech.com/xsl/xsl-list/
C Yahoo XSL-FO group http://groups.yahoo.com/group/XSL-FO/ or
C W3C FO list archives http://lists.w3.org/Archives/Public/www-xsl-fo/
Page 67
8/4/2019 Intro2XSL-FO
72/73
Introduction to XSL-FO Concepts
slide 115
Colophon
C Slides and handouts created from single XML source
C Slides projected from HTML which was created from XML usingXSLT
C Handouts created from XML:
C Source XML transformed to Open Office XML
C Open Office XML opened in Open Office
C Pagination normally adjusted
C Slideshow materials available at:
http://www.mulberrytech.com/slideshow
Page 68
8/4/2019 Intro2XSL-FO
73/73
Introduction to XSL-FO Concepts
Appendix 1
The Most Basic Formatting Properties
Block Properties ()
margin-top -bottom -left -right [7.10.1 - .4]
border-before -after -start -end [7.7.7 - .30]
padding-before -after -start -endwith -color -style -width
[7.7.31 - .38]
space-before -after; start- end-indent [7.10.5 - .8]
line-height [7.15.4]
text-align, text-align-last [7.15.9 - .10]
text-indent [7.15.11]
break-before -after [7.19.1 - .2]
keep-together -with-next with-previous [7.19.3 - .5]
orphans, widows [7.19.6 - .7]
Text Properties ()
font-family [7.8.2]
font-size [7.8.4]
font-style [7.8.7]
font-weight [7.8.9]
text-decoration [7.16.4]
text-transform [7.16.6]
color
There are many other properties for blocks and wrappers.
Note in particular that an will also accept font-relatedattributes.
Tip: Check the compliance table for the XSL-FO formatting engine you usefor both its limitations and its extensions.