Please refer to the errata for this document, which may include normative corrections.
See also translations.
This document is also available in these non-normative formats: PDF by RenderX and XML file.
Copyright © 2006 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C liability, trademark and document use rules apply.
This specification defines the features and syntax for the Extensible Stylesheet Language (XSL), a language for expressing stylesheets. It consists of two parts:
a language for transforming XML documents (XSLT), and
an XML vocabulary for specifying formatting semantics.
An XSL stylesheet specifies the presentation of a class of XML documents by describing how an instance of the class is transformed into an XML document that uses the formatting vocabulary.
This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current W3C publications and the latest revision of this technical report can be found in the W3C technical reports index at http://www.w3.org/TR/.
Please see the Working Group's implementation report.
This Recommendation supersedes [XSL 1.0], which was published 15 October 2001. New functionality has been added to support change marks, indexes, multiple flows, and bookmarks. Existing functionality has been extended in the areas of graphics scaling, "markers" and their retrieval in tables to support e.g. partial sums, and page number referencing. The changes made in this document are intended to meet the requirements for XSL 1.1 described in [XSL 1.1 Requirements]. A number of errata have been incorporated into the text. See E Changes from XSL 1.0.
This document has been produced as part of the W3C XML Activity by the XSL Working Group.
Please send comments about this document to xsl-editors@w3.org (with public archive).
General public discussion of XSL takes place on the XSL-List and on the www-xsl-fo mailing lists.
This document has been reviewed by W3C Members, by software developers, and by other W3C groups and interested parties, and is endorsed by the Director as a W3C Recommendation. It is a stable document and may be used as reference material or cited from another document. W3C's role in making the Recommendation is to draw attention to the specification and to promote its widespread deployment. This enhances the functionality and interoperability of the Web.
This document was produced by a group operating under the 5 February 2004 W3C Patent Policy. W3C maintains a public list of any patent disclosures made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains Essential Claim(s) must disclose the information in accordance with section 6 of the W3C Patent Policy.
1 Introduction and Overview
1.1 Processing a Stylesheet
1.1.1 Tree Transformations
1.1.2 Formatting
1.2 Benefits of XSL
1.2.1 Paging and Scrolling
1.2.2 Selectors and Tree Construction
1.2.3 An Extended Page Layout Model
1.2.4 A Comprehensive Area Model
1.2.5 Internationalization and Writing-Modes
1.2.6 Linking
2 XSL Transformation
2.1 Tree Construction
2.2 XSL Namespace
3 Introduction to Formatting
3.1 Conceptual Procedure
4 Area Model
4.1 Introduction
4.2 Rectangular Areas
4.2.1 Area Types
4.2.2 Common Traits
4.2.3 Geometric Definitions
4.2.4 Tree Ordering
4.2.5 Stacking Constraints
4.2.6 Font Baseline Tables
4.3 Spaces and Conditionality
4.3.1 Space-resolution Rules
4.3.2 Overconstrained space-specifiers
4.4 Block-areas
4.4.1 Stacked Block-areas
4.4.2 Intrusion Adjustments
4.5 Line-areas
4.6 Inline-areas
4.6.1 Stacked Inline-areas
4.6.2 Glyph-areas
4.7 Ordering Constraints
4.7.1 General Ordering Constraints
4.7.2 Line-building
4.7.3 Inline-building
4.8 Keeps and Breaks
4.9 Rendering Model
4.9.1 Geometry
4.9.2 Viewport Geometry
4.9.3 Visibility
4.9.4 Border, Padding, and Background
4.9.5 Intrinsic Marks
4.9.6 Layering and Conflict of Marks
4.10 Sample Area Tree
5 Property Refinement / Resolution
5.1 Specified, Computed, and Actual Values, and Inheritance
5.1.1 Specified Values
5.1.2 Computed Values
5.1.3 Actual Values
5.1.4 Inheritance
5.2 Shorthand Expansion
5.3 Computing the Values of Corresponding Properties
5.3.1 Border and Padding Properties
5.3.2 Margin, Space, and Indent Properties
5.3.3 Height, and Width Properties
5.3.4 Overconstrained Geometry
5.4 Simple Property to Trait Mapping
5.4.1 Background-position-horizontal and background-position-vertical Properties
5.4.2 Column-number Property
5.4.3 Text-align Property
5.4.4 Text-align-last Property
5.4.5 z-index Property
5.4.6 Language Property
5.5 Complex Property to Trait Mapping
5.5.1 Word spacing and Letter spacing Properties
5.5.2 Reference-orientation Property
5.5.3 Writing-mode and Direction Properties
5.5.4 Absolute-position Property
5.5.5 Relative-position Property
5.5.6 Text-decoration Property
5.5.7 Font Properties
5.6 Non-property Based Trait Generation
5.7 Property Based Transformations
5.7.1 Text-transform Property
5.8 Unicode BIDI Processing
5.9 Expressions
5.9.1 Property Context
5.9.2 Evaluation Order
5.9.3 Basics
5.9.4 Function Calls
5.9.5 Numerics
5.9.6 Absolute Numerics
5.9.7 Relative Numerics
5.9.7.1 Percents
5.9.7.2 Relative Lengths
5.9.8 Strings
5.9.9 Colors
5.9.10 Keywords
5.9.10.1 inherit
5.9.11 Lexical Structure
5.9.12 Expression Value Conversions
5.9.13 Definitions of Units of Measure
5.9.13.1 Pixels
5.10 Core Function Library
5.10.1 Number Functions
5.10.2 Color Functions
5.10.3 Font Functions
5.10.4 Property Value Functions
5.11 Property Datatypes
6 Formatting Objects
6.1 Introduction to Formatting Objects
6.1.1 Definitions Common to Many Formatting Objects
6.2 Formatting Object Content
6.3 Formatting Objects Summary
6.4 Declarations and Pagination and Layout Formatting Objects
6.4.1 Introduction
6.4.1.1 Page-sequence-masters
6.4.1.2 Page-masters
6.4.1.3 Page Generation
6.4.1.4 Flows and Flow Mapping
6.4.1.5 Constraints on Page Generation
6.4.1.6 Pagination Tree Structure
6.4.1.7 Example Flow Maps
6.4.1.7.1 Two flows mapping into their own regions
6.4.1.7.2 A flow mapping into two regions
6.4.1.7.3 Two flows mapping into a region
6.4.1.7.4 Two flows mapping into two regions
6.4.2 fo:root
6.4.3 fo:declarations
6.4.4 fo:color-profile
6.4.5 fo:page-sequence
6.4.6 fo:page-sequence-wrapper
6.4.7 fo:layout-master-set
6.4.8 fo:page-sequence-master
6.4.9 fo:single-page-master-reference
6.4.10 fo:repeatable-page-master-reference
6.4.11 fo:repeatable-page-master-alternatives
6.4.12 fo:conditional-page-master-reference
6.4.13 fo:simple-page-master
6.4.14 fo:region-body
6.4.15 fo:region-before
6.4.16 fo:region-after
6.4.17 fo:region-start
6.4.18 fo:region-end
6.4.19 fo:flow
6.4.20 fo:static-content
6.4.21 fo:title
6.4.22 fo:flow-map
6.4.23 fo:flow-assignment
6.4.24 fo:flow-source-list
6.4.25 fo:flow-name-specifier
6.4.26 fo:flow-target-list
6.4.27 fo:region-name-specifier
6.5 Block-level Formatting Objects
6.5.1 Introduction
6.5.1.1 Example
6.5.2 fo:block
6.5.3 fo:block-container
6.6 Inline-level Formatting Objects
6.6.1 Introduction
6.6.1.1 Examples
6.6.1.1.1 First Line of Paragraph in Small-caps
6.6.1.1.2 Figure with a Photograph
6.6.1.1.3 Page numbering and page number reference
6.6.1.1.4 Table of Contents with Leaders
6.6.2 fo:bidi-override
6.6.3 fo:character
6.6.4 fo:initial-property-set
6.6.5 fo:external-graphic
6.6.6 fo:instream-foreign-object
6.6.7 fo:inline
6.6.8 fo:inline-container
6.6.9 fo:leader
6.6.10 fo:page-number
6.6.11 fo:page-number-citation
6.6.12 fo:page-number-citation-last
6.6.13 fo:folio-prefix
6.6.14 fo:folio-suffix
6.6.15 fo:scaling-value-citation
6.7 Formatting Objects for Tables
6.7.1 Introduction
6.7.1.1 Examples
6.7.1.1.1 Simple Table, Centered and Indented
6.7.1.1.2 Simple Table with Relative Column-width Specifications
6.7.2 fo:table-and-caption
6.7.3 fo:table
6.7.4 fo:table-column
6.7.5 fo:table-caption
6.7.6 fo:table-header
6.7.7 fo:table-footer
6.7.8 fo:table-body
6.7.9 fo:table-row
6.7.10 fo:table-cell
6.8 Formatting Objects for Lists
6.8.1 Introduction
6.8.1.1 Examples
6.8.1.1.1 Enumerated List
6.8.1.1.2 HTML-style "dl" lists
6.8.2 fo:list-block
6.8.3 fo:list-item
6.8.4 fo:list-item-body
6.8.5 fo:list-item-label
6.9 Dynamic Effects: Link and Multi Formatting Objects
6.9.1 Introduction
6.9.1.1 Examples
6.9.1.1.1 Expandable/Collapsible Table of Contents
6.9.1.1.2 Styling an XLink Based on the Active State
6.9.2 fo:basic-link
6.9.3 fo:multi-switch
6.9.4 fo:multi-case
6.9.5 fo:multi-toggle
6.9.6 fo:multi-properties
6.9.7 fo:multi-property-set
6.10 Formatting Objects for Indexing
6.10.1 Introduction
6.10.1.1 Example
6.10.1.1.1 Associating Index Keys with Formatting Objects
6.10.1.1.2 Building the Index
6.10.1.2 Processing the Example Index
6.10.1.2.1 merge-pages-across-index-key-references="leave-separate"
6.10.1.2.2 merge-pages-across-index-key-references="merge"
6.10.1.3 Example Index
6.10.2 fo:index-page-number-prefix
6.10.3 fo:index-page-number-suffix
6.10.4 fo:index-range-begin
6.10.5 fo:index-range-end
6.10.6 fo:index-key-reference
6.10.7 fo:index-page-citation-list
6.10.8 fo:index-page-citation-list-separator
6.10.9 fo:index-page-citation-range-separator
6.11 Formatting Objects for Bookmarks
6.11.1 fo:bookmark-tree
6.11.2 fo:bookmark
6.11.3 fo:bookmark-title
6.12 Out-of-Line Formatting Objects
6.12.1 Introduction
6.12.1.1 Floats
6.12.1.2 Footnotes
6.12.1.3 Conditional Sub-Regions
6.12.1.4 Examples
6.12.1.4.1 Floating Figure
6.12.1.4.2 Footnote
6.12.2 fo:float
6.12.3 fo:footnote
6.12.4 fo:footnote-body
6.13 Other Formatting Objects
6.13.1 Introduction
6.13.1.1 Examples
6.13.1.1.1 Wrapper
6.13.1.1.2 Table Markers
6.13.2 fo:change-bar-begin
6.13.3 fo:change-bar-end
6.13.4 fo:wrapper
6.13.5 fo:marker
6.13.6 fo:retrieve-marker
6.13.7 fo:retrieve-table-marker
7 Formatting Properties
7.1 Description of Property Groups
7.2 XSL Areas and the CSS Box Model
7.3 Reference Rectangle for Percentage Computations
7.4 Additional CSS Datatypes
7.5 Common Accessibility Properties
7.5.1 source-document
7.5.2 role
7.6 Common Absolute Position Properties
7.6.1 absolute-position
7.6.2 top
7.6.3 right
7.6.4 bottom
7.6.5 left
7.7 Common Aural Properties
7.7.1 azimuth
7.7.2 cue-after
7.7.3 cue-before
7.7.4 elevation
7.7.5 pause-after
7.7.6 pause-before
7.7.7 pitch
7.7.8 pitch-range
7.7.9 play-during
7.7.10 richness
7.7.11 speak
7.7.12 speak-header
7.7.13 speak-numeral
7.7.14 speak-punctuation
7.7.15 speech-rate
7.7.16 stress
7.7.17 voice-family
7.7.18 volume
7.8 Common Border, Padding, and Background Properties
7.8.1 background-attachment
7.8.2 background-color
7.8.3 background-image
7.8.4 background-repeat
7.8.5 background-position-horizontal
7.8.6 background-position-vertical
7.8.7 border-before-color
7.8.8 border-before-style
7.8.9 border-before-width
7.8.10 border-after-color
7.8.11 border-after-style
7.8.12 border-after-width
7.8.13 border-start-color
7.8.14 border-start-style
7.8.15 border-start-width
7.8.16 border-end-color
7.8.17 border-end-style
7.8.18 border-end-width
7.8.19 border-top-color
7.8.20 border-top-style
7.8.21 border-top-width
7.8.22 border-bottom-color
7.8.23 border-bottom-style
7.8.24 border-bottom-width
7.8.25 border-left-color
7.8.26 border-left-style
7.8.27 border-left-width
7.8.28 border-right-color
7.8.29 border-right-style
7.8.30 border-right-width
7.8.31 padding-before
7.8.32 padding-after
7.8.33 padding-start
7.8.34 padding-end
7.8.35 padding-top
7.8.36 padding-bottom
7.8.37 padding-left
7.8.38 padding-right
7.9 Common Font Properties
7.9.1 Fonts and Font Data
7.9.2 font-family
7.9.3 font-selection-strategy
7.9.4 font-size
7.9.5 font-stretch
7.9.6 font-size-adjust
7.9.7 font-style
7.9.8 font-variant
7.9.9 font-weight
7.10 Common Hyphenation Properties
7.10.1 country
7.10.2 language
7.10.3 script
7.10.4 hyphenate
7.10.5 hyphenation-character
7.10.6 hyphenation-push-character-count
7.10.7 hyphenation-remain-character-count
7.11 Common Margin Properties-Block
7.11.1 margin-top
7.11.2 margin-bottom
7.11.3 margin-left
7.11.4 margin-right
7.11.5 space-before
7.11.6 space-after
7.11.7 start-indent
7.11.8 end-indent
7.12 Common Margin Properties-Inline
7.12.1 margin-top
7.12.2 margin-bottom
7.12.3 margin-left
7.12.4 margin-right
7.12.5 space-end
7.12.6 space-start
7.13 Common Relative Position Properties
7.13.1 top
7.13.2 right
7.13.3 bottom
7.13.4 left
7.13.5 relative-position
7.14 Area Alignment Properties
7.14.1 alignment-adjust
7.14.2 alignment-baseline
7.14.3 baseline-shift
7.14.4 display-align
7.14.5 dominant-baseline
7.14.6 relative-align
7.15 Area Dimension Properties
7.15.1 allowed-height-scale
7.15.2 allowed-width-scale
7.15.3 block-progression-dimension
7.15.4 content-height
7.15.5 content-width
7.15.6 height
7.15.7 inline-progression-dimension
7.15.8 max-height
7.15.9 max-width
7.15.10 min-height
7.15.11 min-width
7.15.12 scaling
7.15.13 scaling-method
7.15.14 width
7.16 Block and Line-related Properties
7.16.1 hyphenation-keep
7.16.2 hyphenation-ladder-count
7.16.3 last-line-end-indent
7.16.4 line-height
7.16.5 line-height-shift-adjustment
7.16.6 line-stacking-strategy
7.16.7 linefeed-treatment
7.16.8 white-space-treatment
7.16.9 text-align
7.16.10 text-align-last
7.16.11 text-indent
7.16.12 white-space-collapse
7.16.13 wrap-option
7.17 Character Properties
7.17.1 character
7.17.2 letter-spacing
7.17.3 suppress-at-line-break
7.17.4 text-decoration
7.17.5 text-shadow
7.17.6 text-transform
7.17.7 treat-as-word-space
7.17.8 word-spacing
7.18 Color-related Properties
7.18.1 color
7.18.2 color-profile-name
7.18.3 rendering-intent
7.19 Float-related Properties
7.19.1 clear
7.19.2 float
7.19.3 intrusion-displace
7.20 Keeps and Breaks Properties
7.20.1 break-after
7.20.2 break-before
7.20.3 keep-together
7.20.4 keep-with-next
7.20.5 keep-with-previous
7.20.6 orphans
7.20.7 widows
7.21 Layout-related Properties
7.21.1 clip
7.21.2 overflow
7.21.3 reference-orientation
7.21.4 span
7.22 Leader and Rule Properties
7.22.1 leader-alignment
7.22.2 leader-pattern
7.22.3 leader-pattern-width
7.22.4 leader-length
7.22.5 rule-style
7.22.6 rule-thickness
7.23 Properties for Dynamic Effects Formatting Objects
7.23.1 active-state
7.23.2 auto-restore
7.23.3 case-name
7.23.4 case-title
7.23.5 destination-placement-offset
7.23.6 external-destination
7.23.7 indicate-destination
7.23.8 internal-destination
7.23.9 show-destination
7.23.10 starting-state
7.23.11 switch-to
7.23.12 target-presentation-context
7.23.13 target-processing-context
7.23.14 target-stylesheet
7.24 Properties for Indexing
7.24.1 index-class
7.24.2 index-key
7.24.3 page-number-treatment
7.24.4 merge-ranges-across-index-key-references
7.24.5 merge-sequential-page-numbers
7.24.6 merge-pages-across-index-key-references
7.24.7 ref-index-key
7.25 Properties for Markers
7.25.1 marker-class-name
7.25.2 retrieve-boundary-within-table
7.25.3 retrieve-class-name
7.25.4 retrieve-position
7.25.5 retrieve-boundary
7.25.6 retrieve-position-within-table
7.26 Properties for Number to String Conversion
7.26.1 format
7.26.2 grouping-separator
7.26.3 grouping-size
7.26.4 letter-value
7.27 Pagination and Layout Properties
7.27.1 blank-or-not-blank
7.27.2 column-count
7.27.3 column-gap
7.27.4 extent
7.27.5 flow-name
7.27.6 force-page-count
7.27.7 initial-page-number
7.27.8 master-name
7.27.9 master-reference
7.27.10 maximum-repeats
7.27.11 media-usage
7.27.12 odd-or-even
7.27.13 page-height
7.27.14 page-position
7.27.15 page-width
7.27.16 precedence
7.27.17 region-name
7.27.18 flow-map-name
7.27.19 flow-map-reference
7.27.20 flow-name-reference
7.27.21 region-name-reference
7.28 Table Properties
7.28.1 border-after-precedence
7.28.2 border-before-precedence
7.28.3 border-collapse
7.28.4 border-end-precedence
7.28.5 border-separation
7.28.6 border-start-precedence
7.28.7 caption-side
7.28.8 column-number
7.28.9 column-width
7.28.10 empty-cells
7.28.11 ends-row
7.28.12 number-columns-repeated
7.28.13 number-columns-spanned
7.28.14 number-rows-spanned
7.28.15 starts-row
7.28.16 table-layout
7.28.17 table-omit-footer-at-break
7.28.18 table-omit-header-at-break
7.29 Writing-mode-related Properties
7.29.1 direction
7.29.2 glyph-orientation-horizontal
7.29.3 glyph-orientation-vertical
7.29.4 text-altitude
7.29.5 text-depth
7.29.6 unicode-bidi
7.29.7 writing-mode
7.30 Miscellaneous Properties
7.30.1 change-bar-class
7.30.2 change-bar-color
7.30.3 change-bar-offset
7.30.4 change-bar-placement
7.30.5 change-bar-style
7.30.6 change-bar-width
7.30.7 content-type
7.30.8 id
7.30.9 intrinsic-scale-value
7.30.10 page-citation-strategy
7.30.11 provisional-label-separation
7.30.12 provisional-distance-between-starts
7.30.13 ref-id
7.30.14 scale-option
7.30.15 score-spaces
7.30.16 src
7.30.17 visibility
7.30.18 z-index
7.31 Shorthand Properties
7.31.1 background
7.31.2 background-position
7.31.3 border
7.31.4 border-bottom
7.31.5 border-color
7.31.6 border-left
7.31.7 border-right
7.31.8 border-style
7.31.9 border-spacing
7.31.10 border-top
7.31.11 border-width
7.31.12 cue
7.31.13 font
7.31.14 margin
7.31.15 padding
7.31.16 page-break-after
7.31.17 page-break-before
7.31.18 page-break-inside
7.31.19 pause
7.31.20 position
7.31.21 size
7.31.22 vertical-align
7.31.23 white-space
7.31.24 xml:lang
8 Conformance
A Formatting Object Summary
A.1 Declaration and Pagination and Layout Formatting Objects
A.2 Block Formatting Objects
A.3 Inline Formatting Objects
A.4 Table Formatting Objects
A.5 List Formatting Objects
A.6 Link and Multi Formatting Objects
A.7 Out-of-line Formatting Objects
A.8 Formatting Objects for Indexing
A.9 Formatting Objects for Bookmarks
A.10 Other Formatting Objects
B Property Summary
B.1 Explanation of Trait Mapping Values
B.2 Property Table: Part I
B.3 Property Table: Part II
B.4 Properties and the FOs they apply to
C References
C.1 Normative References
C.2 Other References
D Property Index
E Changes from XSL 1.0 (Non-Normative)
F Acknowledgements (Non-Normative)
This specification defines the Extensible Stylesheet Language (XSL). XSL is a language for expressing stylesheets. Given a class of arbitrarily structured XML [XML] or [XML 1.1] documents or data files, designers use an XSL stylesheet to express their intentions about how that structured content should be presented; that is, how the source content should be styled, laid out, and paginated onto some presentation medium, such as a window in a Web browser or a hand-held device, or a set of physical pages in a catalog, report, pamphlet, or book.
An XSL stylesheet processor accepts a document or data in XML and an XSL stylesheet and produces the presentation of that XML source content that was intended by the designer of that stylesheet. There are two aspects of this presentation process: first, constructing a result tree from the XML source tree and second, interpreting the result tree to produce formatted results suitable for presentation on a display, on paper, in speech, or onto other media. The first aspect is called tree transformation and the second is called formatting. The process of formatting is performed by the formatter. This formatter may simply be a rendering engine inside a browser.
Tree transformation allows the structure of the result tree to be significantly different from the structure of the source tree. For example, one could add a table-of-contents as a filtered selection of an original source document, or one could rearrange source data into a sorted tabular presentation. In constructing the result tree, the tree transformation process also adds the information necessary to format that result tree.
Formatting is enabled by including formatting semantics in the result tree. Formatting semantics are expressed in terms of a catalog of classes of formatting objects. The nodes of the result tree are formatting objects. The classes of formatting objects denote typographic abstractions such as page, paragraph, table, and so forth. Finer control over the presentation of these abstractions is provided by a set of formatting properties, such as those controlling indents, word- and letter spacing, and widow, orphan, and hyphenation control. In XSL, the classes of formatting objects and formatting properties provide the vocabulary for expressing presentation intent.
The XSL processing model is intended to be conceptual only. An implementation is not mandated to provide these as separate processes. Furthermore, implementations are free to process the source document in any way that produces the same result as if it were processed using the conceptual XSL processing model. A diagram depicting the detailed conceptual model is shown below.
XSL Two Processes: Transformation & Formatting
Tree transformation constructs the result tree. In XSL, this tree is called the element and attribute tree, with objects primarily in the "formatting object" namespace. In this tree, a formatting object is represented as an XML element, with the properties represented by a set of XML attribute-value pairs. The content of the formatting object is the content of the XML element. Tree transformation is defined in the XSLT Recommendation [XSLT]. A diagram depicting this conceptual process is shown below.
Transform to Another Vocabulary
The XSL stylesheet is used in tree transformation. A stylesheet contains a set of tree construction rules. The tree construction rules have two parts: a pattern that is matched against elements in the source tree and a template that constructs a portion of the result tree. This allows a stylesheet to be applicable to a wide class of documents that have similar source tree structures.
In some implementations of XSL/XSLT, the result of tree construction can be output as an XML document. This would allow an XML document which contains formatting objects and formatting properties to be output. This capability is neither necessary for an XSL processor nor is it encouraged. There are, however, cases where this is important, such as a server preparing input for a known client; for example, the way that a WAP (http://www.wapforum.org/faqs/index.htm) server prepares specialized input for a WAP capable hand held device. To preserve accessibility, designers of Web systems should not develop architectures that require (or use) the transmission of documents containing formatting objects and properties unless either the transmitter knows that the client can accept formatting objects and properties or the transmitted document contains a reference to the source document(s) used in the construction of the document with the formatting objects and properties.
Formatting interprets the result tree in its formatting object tree form to produce the presentation intended by the designer of the stylesheet from which the XML element and attribute tree in the "fo" namespace was constructed.
The vocabulary of formatting objects supported by XSL - the set of
fo: element types - represents the set of
typographic abstractions available to the
designer. Semantically, each formatting object represents a
specification for a part of the pagination, layout, and styling
information that will be applied to the content of that formatting
object as a result of formatting the whole result tree. Each
formatting object class represents a particular kind of formatting
behavior. For example, the block formatting object class represents
the breaking of the content of a paragraph into lines. Other parts of
the specification may come from other formatting objects; for
example, the formatting of a paragraph (block formatting
object)
depends on both the specification of properties on the block
formatting object and the specification of the layout structure into
which the block is placed by the formatter.
The properties associated with an instance of a formatting object control the formatting of that object. Some of the properties, for example "color", directly specify the formatted result. Other properties, for example 'space-before', only constrain the set of possible formatted results without specifying any particular formatted result. The formatter may make choices among other possible considerations such as esthetics.
Formatting consists of the generation of a tree of geometric areas, called the area tree. The geometric areas are positioned on a sequence of one or more pages (a browser typically uses a single page). Each geometric area has a position on the page, a specification of what to display in that area and may have a background, padding, and borders. For example, formatting a single character generates an area sufficiently large enough to hold the glyph that is used to present the character visually and the glyph is what is displayed in this area. These areas may be nested. For example, the glyph may be positioned within a line, within a block, within a page.
Rendering takes the area tree, the abstract model of the presentation (in terms of pages and their collections of areas), and causes a presentation to appear on the relevant medium, such as a browser window on a computer display screen or sheets of paper. The semantics of rendering are not described in detail in this specification.
The first step in formatting is to "objectify" the element and attribute tree obtained via an XSLT transformation. Objectifying the tree basically consists of turning the elements in the tree into formatting object nodes and the attributes into property specifications. The result of this step is the formatting object tree.
Build the XSL Formatting Object Tree
As part of the step of objectifying, the characters that occur in the result tree are replaced by fo:character nodes. Characters in text nodes which consist solely of white space characters and which are children of elements whose corresponding formatting objects do not permit fo:character nodes as children are ignored. Other characters within elements whose corresponding formatting objects do not permit fo:character nodes as children are errors.
The content of the fo:instream-foreign-object is not objectified; instead the object representing the fo:instream-foreign-object element points to the appropriate node in the element and attribute tree. Similarly any non-XSL namespace child element of fo:declarations is not objectified; instead the object representing the fo:declarations element points to the appropriate node in the element and attribute tree.
The second phase in formatting is to refine the formatting object tree to produce the refined formatting object tree. The refinement process handles the mapping from properties to traits. This consists of: (1) shorthand expansion into individual properties, (2) mapping of corresponding properties, (3) determining computed values (may include expression evaluation), (4) handling white-space-treatment and linefeed-treatment property effects, and (5) inheritance. Details on refinement are found in 5 Property Refinement / Resolution.
The refinement step is depicted in the diagram below.
Refine the Formatting Object Tree
The third step in formatting is the construction of the area tree. The area tree is generated as described in the semantics of each formatting object. The traits applicable to each formatting object class control how the areas are generated. Although every formatting property may be specified on every formatting object, for each formatting object class, only a subset of the formatting properties are used to determine the traits for objects of that class.
Area generation is depicted in the diagram below.
Generate the Area Tree
Summary of the Process
Unlike the case of HTML, element names in XML have no intrinsic presentation semantics. Absent a stylesheet, a processor could not possibly know how to render the content of an XML document other than as an undifferentiated string of characters. XSL provides a comprehensive model and a vocabulary for writing such stylesheets using XML syntax.
This document is intended for implementors of such XSL processors. Although it can be used as a reference manual for writers of XSL stylesheets, it is not tutorial in nature.
XSL builds on the prior work on Cascading Style Sheets [CSS2] and the Document Style Semantics and Specification Language [DSSSL]. While many of XSL's formatting objects and properties correspond to the common set of properties, this would not be sufficient by itself to accomplish all the goals of XSL. In particular, XSL introduces a model for pagination and layout that extends what is currently available and that can in turn be extended, in a straightforward way, to page structures beyond the simple page models described in this specification.
Doing both scrollable document windows and pagination introduces new complexities to the styling (and pagination) of XML content. Because pagination introduces arbitrary boundaries (pages or regions on pages) on the content, concepts such as the control of spacing at page, region, and block boundaries become extremely important. There are also concepts related to adjusting the spaces between lines (to adjust the page vertically) and between words and letters (to justify the lines of text). These do not always arise with simple scrollable document windows, such as those found in today's browsers. However, there is a correspondence between a page with multiple regions, such as a body, header, footer, and left and right sidebars, and a Web presentation using "frames". The distribution of content into the regions is basically the same in both cases, and XSL handles both cases in an analogous fashion.
XSL was developed to give designers control over the features needed when documents are paginated as well as to provide an equivalent "frame" based structure for browsing on the Web. To achieve this control, XSL has extended the set of formatting objects and formatting properties beyond those available in either CSS2 or DSSSL. In addition, the selection of XML source components that can be styled (elements, attributes, text nodes, comments, and processing instructions) is based on XSLT and XPath [XPath], thus providing the user with an extremely powerful selection mechanism.
The design of the formatting objects and properties extensions was first inspired by DSSSL. The actual extensions, however, do not always look like the DSSSL constructs on which they were based. To either conform more closely with the CSS2 specification or to handle cases more simply than in DSSSL, some extensions have diverged from DSSSL.
There are several ways in which extensions were made. In some cases, it sufficed to add new values, as in the case of those added to reflect a variety of writing-modes, such as top-to-bottom and bottom-to-top, rather than just left-to-right and right-to-left.
In other cases, common properties that are expressed in CSS2 as one property with multiple simultaneous values, were split into several new properties to provide independent control over independent aspects of the property. For example, the "white-space" property was split into four properties: a "white-space-treatment" property that controls how white space is processed, a "linefeed-treatment" property that controls how line feeds are processed, a "white-space-collapse" property that controls how multiple consecutive spaces are collapsed, and a "wrap-option" property that controls whether lines are automatically wrapped when they encounter a boundary, such as the edge of a column. The effect of splitting a property into two or more (sub-)properties is to make the equivalent existing CSS2 property a "shorthand" for the set of sub-properties it subsumes.
In still other cases, it was necessary to create new properties. For example, there are a number of new properties that control how hyphenation is done. These include identifying the script and country the text is from as well as such properties as "hyphenation-character" (which varies from script to script).
Some of the formatting objects and many of the properties in XSL come from the CSS2 specification, ensuring compatibility between the two.
There are four classes of XSL properties that can be identified as:
CSS properties by copy (unchanged from their CSS2 semantics)
CSS properties with extended values
CSS properties broken apart and/or extended
XSL-only properties
As mentioned above, XSL uses XSLT and XPath for tree construction and pattern selection, thus providing a high degree of control over how portions of the source content are presented, and what properties are associated with those content portions, even where mixed namespaces are involved.
For example, the patterns of XPath allow the selection of a portion of a string or the Nth text node in a paragraph. This allows users to have a rule that makes all third paragraphs in procedural steps appear in bold, for instance. In addition, properties can be associated with a content portion based on the numeric value of that content portion or attributes on the containing element. This allows one to have a style rule that makes negative values appear in "red" and positive values appear in "black". Also, text can be generated depending on a particular context in the source tree, or portions of the source tree may be presented multiple times with different styles.
There is a set of formatting objects in XSL to describe both the layout structure of a page or "frame" (how big is the body; are there multiple columns; are there headers, footers, or sidebars; how big are these) and the rules by which the XML source content is placed into these "containers".
The layout structure is defined in terms of one or more instances of a "simple-page-master" formatting object. This formatting object allows one to define independently filled regions for the body (with multiple columns), a header, a footer, and sidebars on a page. These simple-page-masters can be used in page sequences that specify in which order the various simple-page-masters shall be used. The page sequence also specifies how styled content is to fill those pages. This model allows one to specify a sequence of simple-page-masters for a book chapter where the page instances are automatically generated by the formatter or an explicit sequence of pages such as used in a magazine layout. Styled content is assigned to the various regions on a page by associating the name of the region with names attached to styled content in the result tree.
In addition to these layout formatting objects and properties, there are properties designed to provide the level of control over formatting that is typical of paginated documents. This includes control over hyphenation, and expanding the control over text that is kept with other text in the same line, column, or on the same page.
The extension of the properties and formatting objects, particularly in the area on control over the spacing of blocks, lines, and page regions and within lines, necessitated an extension of the CSS2 box formatting model. This extended model is described in 4 Area Model of this specification. The CSS2 box model is a subset of this model. See the mapping of the CSS2 box model terminology to the XSL Area Model terminology in 7.2 XSL Areas and the CSS Box Model. The area model provides a vocabulary for describing the relationships and space-adjustment between letters, words, lines, and blocks.
There are some scripts, in particular in the Far East, that are typically set with words proceeding from top-to-bottom and lines proceeding either from right-to-left (most common) or from left-to-right. Other directions are also used. Properties expressed in terms of a fixed, absolute frame of reference (using top, bottom, left, and right) and which apply only to a notion of words proceeding from left to right or right to left do not generalize well to text written in those scripts.
For this reason XSL (and before it DSSSL) uses a relative frame of reference for the formatting object and property descriptions. Just as the CSS2 frame of reference has four directions (top, bottom, left and right), so does the XSL relative frame of reference have four directions (before, after, start, and end), but these are relative to the "writing-mode". The "writing-mode" property is a way of controlling the directions needed by a formatter to correctly place glyphs, words, lines, blocks, etc. on the page or screen. The "writing-mode" expresses the basic directions noted above. There are writing-modes for "left-to-right - top-to-bottom" (denoted as "lr-tb"), "right-to-left - top-to-bottom" (denoted as "rl-tb"), "top-to-bottom - right-to-left" (denoted as "tb-rl") and more. See 7.29.7 writing-mode for the description of the "writing-mode" property. Typically, the writing-mode value specifies two directions: the first is the inline-progression-direction which determines the direction in which words will be placed and the second is the block-progression-direction which determines the direction in which blocks (and lines) are placed one after another. In addition, the inline-progression-direction for a sequence of characters may be implicitly determined using bidirectional character types for those characters from the Unicode Character Database [UNICODE Character Database] for those characters and the Unicode bidirectional (BIDI) algorithm [UNICODE UAX #9].
Besides the directions that are explicit in the name of the value of the "writing-mode" property, the writing-mode determines other directions needed by the formatter, such as the shift-direction (used for subscripts and superscripts), etc.
Because XML, unlike HTML, has no built-in semantics, there is no built-in notion of a hypertext link. In this context, "link" refers to "hypertext link" as defined in http://www.w3.org/TR/html401/struct/links.html#h-12.1 as well as some of the aspects of "link" as defined in http://www.w3.org/TR/xlink/#intro, where "link is a relationship between two or more resources or portions of resources, made explicit by an XLink linking element". Therefore, XSL has a formatting object that expresses the dual semantics of formatting the content of the link reference and the semantics of following the link.
XSL provides a few mechanisms for changing the presentation of a link target that is being visited. One of these mechanisms permits indicating the link target as such; another allows for control over the placement of the link target in the viewing area; still another permits some degree of control over the way the link target is displayed in relationship to the originating link anchor.
XSL also provides a general mechanism for changing the way elements are formatted depending on their active state. This is particularly useful in relation to links, to indicate whether a given link reference has already been visited, or to apply a given style depending on whether the mouse, for instance, is hovering over the link reference or not.
The Tree Construction is described in "XSL Transformations" [XSLT]. The data model in XSLT is capable of representing either an XML 1.0 document (conforming to [XML] and [XML Names]) or an XML 1.1 document (conforming to [XML 1.1] and [XML Names 1.1]), and it makes no distinction between the two. In principle, therefore, XSL 1.1 can be used with either of these XML versions; the only differences arise outside the boundary of the transformation proper, while creating the data model from textual XML (parsing).
The provisions in "XSL Transformations" form an integral part of this Recommendation and are considered normative. Because the data model is the same whether the original document was XML 1.0 or XML 1.1, the semantics of XSLT processing do not depend on the version of XML used by the original document. There is no reason in principle why all the documents used in a single transformation must conform to the same version of XML.
The XSL namespace has the URI http://www.w3.org/1999/XSL/Format.
Note:
The 1999 in the URI indicates the year in which
the URI was allocated by the W3C. It does not indicate the version of
XSL being used.
XSL processors must use the XML namespaces mechanism ([XML Names] or [XML Names 1.1]) to recognize elements and attributes from this namespace. Elements from the XSL namespace are recognized only in the stylesheet, not in the source document. Implementors must not extend the XSL namespace with additional elements or attributes. Instead, any extension must be in a separate namespace. The expanded-name of extension elements must have a non-null namespace URI.
This specification uses the prefix fo: for referring
to elements in the XSL namespace. However, XSL stylesheets are free
to use any prefix, provided that there is a namespace declaration that
binds the prefix to the URI of the XSL namespace.
An element from the XSL namespace may have any attribute not from the XSL namespace, provided that the expanded-name of the attribute has a non-null namespace URI. The presence of such attributes must not change the behavior of XSL elements and functions defined in this document. This means that an extension attribute may change the processing of an FO, but only provided that the constraints specified by XSL on that FO remain satisfied. Thus, an XSL processor is always free to ignore such attributes, and must ignore such attributes without giving an error if it does not recognize the namespace URI. Such attributes can provide, for example, unique identifiers, optimization hints, or documentation.
It is an error for an element from the XSL namespace to have attributes with expanded-names that have null namespace URIs (i.e., attributes with unprefixed names) other than attributes defined in this document.
Note:
The conventions used for the names of XSL elements, attributes, and functions are as follows: names are all lowercase, hyphens are used to separate words, dots are used to separate names for the components of complex datatypes, and abbreviations are used only if they already appear in the syntax of a related language such as XML or HTML.
The aim of this section is to describe the general process of formatting, enough to read the area model and the formatting object descriptions and properties and to understand the process of refinement.
Formatting is the process of turning the result of an XSL transformation into a tangible form for the reader or listener. This process comprises several steps, some of which depend on others in a non-sequential way. Our model for formatting will be the construction of an area tree, which is an ordered tree containing geometric information for the placement of every glyph, 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 properties are to formatting objects and attributes are to XML elements. 4 Area Model will describe the area tree and define the default placement constraints on stacked areas. However, this is an abstract model which need not be actually implemented in this way in a formatter, so long as the resulting tangible form obeys the implied constraints. Constraints might conflict to the point where it is impossible to satisfy them all. In that case, it is implementation-defined which constraints should be relaxed and in what order to satisfy the others.
Formatting objects are elements in the formatting object tree, whose names are from the XSL namespace; a formatting object belongs to a class of formatting objects identified by its element name. 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, and how the areas are structured hierarchically with respect to areas created by other formatting objects. 6 Formatting Objects and 7 Formatting Properties describe formatting objects and their properties.
Some formatting objects are block-level and others are inline-level. This refers to the types of areas which they generate, which in turn refer to their default placement method. Inline-areas (for example, glyph-areas) are collected into lines and the direction in which they are stacked is the inline-progression-direction. Lines are a type of block-area and these are stacked in a direction perpendicular to the inline-progression-direction, called the block-progression-direction. See 4 Area Model for detailed decriptions of these area types and directions.
In Western writing systems, the block-progression-direction is "top-to-bottom" and the inline-progression-direction is "left-to-right". This specification treats other writing systems as well and introduces the terms "block" and "inline" instead of using absolute indicators like "vertical" and "horizontal". Similarly this specification tries to give relatively-specified directions ("before" and "after" in the block-progression-direction, "start" and "end" in the inline-progression-direction) where appropriate, either in addition to or in place of absolutely-specified directions such as "top", "bottom", "left", and "right". These are interpreted according to the value of the writing-mode property.
Central to this model of formatting is refinement. This is a computational process which finalizes the specification of properties based on the attribute values in the XML result tree. Though the XML result tree and the formatting object tree have very similar structure, it is helpful to think of them as separate conceptual entities. Refinement involves
propagating the various inherited values of properties (both implicitly and those with an attribute value of "inherit"),
evaluating expressions in property value specifications into actual values, which are then used to determine the value of the properties,
converting relative numerics to absolute numerics,
constructing some composite properties from more than one attribute
Some of these operations (particularly evaluating expressions) depend on knowledge of the area tree. Thus refinement is not necessarily a straightforward, sequential procedure, but may involve look-ahead, back-tracking, or control-splicing with other processes in the formatter. Refinement is described more fully in 5 Property Refinement / Resolution.
To summarize, formatting proceeds by constructing an area tree (containing areas and their traits) which satisfies constraints based on information contained in the XML result tree (containing element nodes and their attributes). Conceptually, there are intermediate steps of constructing a formatting object tree (containing formatting objects and their properties) and refinement; these steps may proceed in an interleaved fashion during the construction of the area tree.
This subsection contains a conceptual description of how formatting could work. This conceptual procedure does not mandate any particular algorithms or data structures as long as the result obeys the implied constraints.
The procedure works by processing formatting objects. Each object, while being processed, may initiate processing of other objects. While the objects are hierarchically structured, the processing is not; processing of a given object is rather like a co-routine which may pass control to other processes, but pick up again later where it left off. The procedure starts by initiating the processing of the fo:root formatting object.
Unless otherwise specified, processing a formatting object creates areas and returns them to its parent to be placed in the area tree. Like a co-routine, when given control, it initiates, then continues formatting of its own children (if any), or some subset of them. The formatting object supplies parameters to its children based on the traits of areas already in the area tree, possibly including areas generated by the formatting object or its ancestors. It then disposes of the areas returned by its formatting object children. It might simply return such an area to its parent (and will always do this if it does not generate areas itself), or alternatively it might arrange the area in the area tree according to the semantics of the formatting object; this may involve changing its geometric position. It terminates processing when all its children have terminated processing (if initiated) and it is finished generating areas.
Some formatting objects do not themselves generate areas; instead these formatting objects simply return the areas returned to them by their children. Alternatively, a formatting object may continue to generate (and return) areas based on information discovered while formatting its own children; for example, the fo:page-sequence formatting object will continue generating pages as long as it contains a flow with unprocessed descendants.
Areas returned to an fo:root formatting object are page-viewport-areas, and are simply placed as children of the area tree root in the order in which they are returned, with no geometrical implications.
As a general rule, the order of the area tree parallels the order of the formatting object tree. That is, if one formatting object precedes another in the depth-first traversal of the formatting object tree, with neither containing the other, then all the areas generated by the first will precede all the areas generated by the second in the depth-first traversal of the area tree, unless otherwise specified. Typical exceptions to this rule would be things like side floats, before floats, and footnotes.
At the end of the procedure, the areas and their traits have been constructed, and they are required to satisfy constraints described in the definitions of their associated formatting objects, and in the area model section. In particular, size and position of the areas will be subject to the placement and spacing constraints described in the area model, unless the formatting object definition indicates otherwise.
The formatting object definitions, property descriptions, and area model are not algorithms. Thus, the formatting object semantics do not specify how the line-breaking algorithm must work in collecting characters into words, positioning words within lines, shifting lines within a container, etc. Rather this specification assumes that the formatter has done these things and describes the constraints which the result is supposed to satisfy. Thus, the constraints do not specify at what time an implementation makes use of that information; the constraints only specify what must be true after processing has been completed. An actual implementation may well make use of some constraints at a time other than when formatting the formatting object for which the constraint applies. For example, the constraint given by the "hyphenate" property on an fo:character would typically be used during line-building, rather than when progessing the fo:character. Other examples include constraints for keeps and breaks.
In XSL, one creates a tree of formatting objects that serve as inputs or specifications to a formatter. The formatter generates a hierarchical arrangement of areas which comprise the formatted result. This section defines the general model of these areas and how they interact. The purpose is to present an abstract framework which is used in describing the semantics of formatting objects. It should be seen as describing a series of constraints for conforming implementations, and not as prescribing particular algorithms.
The formatter generates an ordered tree, the area tree, which describes a geometric structuring of the output medium. The terms child, sibling, parent, descendant, and ancestor refer to this tree structure. The tree has a root node.
Each area tree node other than the root is called an area and is associated to a rectangular portion of the output medium. Areas are not formatting objects; rather, a formatting object generates zero or more rectangular areas, and normally each area is generated by a unique object in the formatting object tree.
Note:
The only exceptions to this rule are when several leaf nodes of the formatting object tree are combined to generate a single area, for example when several characters in sequence generate a single ligature glyph. In all such cases, relevant properties such as font-family and font-size must be the same for all the generating formatting objects (see section 4.7.2 Line-building).
An area has a content-rectangle, the portion in which its child areas are assigned, and optional padding and border. The diagram shows how these portions are related to one another. The outer bound of the border is called the border-rectangle, and the outer bound of the padding is called the padding-rectangle.
Each area has a set of traits, a mapping of names to values, in the way elements have attributes and formatting objects have properties. Individual traits are used either for rendering the area or for defining constraints on the result of formatting, or both. Traits used strictly for formatting purposes or for defining constraints may be called formatting traits, and traits used for rendering may be called rendering traits. Traits whose values are copied or derived from a property of the same or a corresponding name are listed in B Property Summary and 5 Property Refinement / Resolution; other traits are listed below.
Note:
Traits are also associated with FOs during the process of refinement. Some traits are assigned during formatting, while others are already present after refinement.
The semantics of each type of formatting object that generates areas are given in terms of which areas it generates and their place in the area-tree hierarchy. This may be further modified by interactions between the various types of formatting objects. The properties of the formatting object determine what areas are generated and how the formatting object's content is distributed among them. (For example, a word that is not to be hyphenated may not have its glyphs distributed into areas on two separate line-areas.)
The traits of an area are either:
directly-derived: the values of directly-derived traits are the computed value of a property of the same or a corresponding name on the generating formatting object, or
indirectly-derived: the values of indirectly-derived traits are the result of a computation involving the computed values of one or more properties on the generating formatting object, other traits on this area or other interacting areas (ancestors, parent, siblings, and/or children) and/or one or more values constructed by the formatter. The calculation formula may depend on the type of the formatting object.
This description assumes that refined values have been computed for all properties of formatting objects in the result tree, i.e., all relative and corresponding values have been computed and the inheritable values have been propagated as described in 5 Property Refinement / Resolution. This allows the process of inheritance to be described once and avoids a need to repeat information on computing values in this description.
The indirectly-derived traits are: block-progression-direction, inline-progression-direction, shift-direction, glyph-orientation, is-reference-area, is-viewport-area, left-position, right-position, top-position, bottom-position, left-offset, top-offset, is-first, is-last, alignment-point, area-class, start-intrusion-adjustment, end-intrusion-adjustment, generated-by, returned-by, folio-number, blink, underline-score, overline-score, through-score, underline-score-color, overline-score-color, through-score-color, alignment-baseline, baseline-shift, nominal-font, dominant-baseline-identifier, actual-baseline-table, and script.
There are two types of areas: block-areas and inline-areas. These differ according to how they are typically stacked by the formatter. An area can have block-area children or inline-area children as determined by the generating formatting object, but a given area's children must all be of one type. Although block-areas and inline-areas are typically stacked, some areas can be explicitly positioned.
A line-area is a special kind of block-area whose children are all inline-areas. A glyph-area is a special kind of inline-area which has no child areas, and has a single glyph image as its content.
Typical examples of areas are: a paragraph rendered by using an fo:block formatting object, which generates block-areas, and a character rendered by using an fo:character formatting object, which generates an inline-area (in fact, a glyph-area).
Associated with any area are two directions, which are derived from the generating formatting object's writing-mode and reference-orientation properties: the block-progression-direction is the direction for stacking block-area descendants of the area, and the inline-progression-direction is the direction for stacking inline-area descendants of the area. Another trait, the shift-direction, is present on inline-areas and refers to the direction in which baseline shifts are applied. Also the glyph-orientation defines the orientation of glyph-images in the rendered result.
If the reference-orientation for an area is 0, then the top, bottom, left, and right edges of the content are parallel to those of the area's parent and consistent with them. Otherwise the edges are rotated from those of the area's parent as described in 7.21.3 reference-orientation. The inline-progression-direction and block-progression-direction are determined by the location of these edges as described in 7.29.7 writing-mode.
The Boolean trait is-reference-area determines
whether or not an area establishes a coordinate system for
specifying indents. An area for which this trait is true
is called a reference-area.
Only a reference-area may have a block-progression-direction which is different from
that of its parent.
A reference-area may be either a
block-area or an inline-area.
Only specific formatting objects generate reference areas.
The Boolean trait is-viewport-area determines
whether or not an area establishes an opening through which its
descendant areas can be viewed, and can be used to
present clipped or scrolled material; for example, in printing
applications where bleed and trim is desired.
An area for which this trait is true
is called a viewport-area.
A viewport-area also has the value true
for the is-reference-area trait.
A common construct is a viewport/reference pair. This is a viewport-area V and a block-area reference-area R, where R is the sole child of V and where the start-edge and end-edge of the content-rectangle of R are parallel to the start-edge and end-edge of the content-rectangle of V.
Each area has the traits top-position, bottom-position,
left-position, and right-position which represent the distance
from the edges of its content-rectangle to the like-named edges of the
nearest ancestor reference-area (or the page-viewport-area
in the
case of areas generated by descendants of formatting objects
whose absolute-position is fixed); the left-offset
and top-offset determine the amount by which
a relatively-positioned area is shifted for rendering. These traits receive
their values during the formatting process, or in the case
of absolutely positioned areas, during refinement.
The block-progression-dimension and inline-progression-dimension of an area represent the extent of the content-rectangle of that area in each of the two relative directions.
Other traits include:
the is-first and is-last traits, which are Boolean traits
indicating the order in which areas are generated and returned
(See 6.1.1 Definitions Common to Many Formatting Objects)
by a given
formatting object.
is-first is true
for the first area (or only area) generated and returned by a formatting object,
and is-last
is true for the last area (or only area);
the amount of space outside the border-rectangle: space-before, space-after, space-start, and space-end (though some of these may be required to be zero on certain classes of area);
Note:
"Before", "after", "start", and "end" refer to relative directions and are defined below.
the thickness of each of the four sides of the padding: padding-before, padding-after, padding-start, and padding-end;
the style, thickness, and color of each of the four sides of the border: border-before, etc.;
the background rendering of the area: background-color, background-image, and other background traits; and
the nominal-font for an area, as determined by the font properties and the character descendants of the area's generating formatting object. (see 5.5.7 Font Properties)
Unless otherwise specified, the traits of a formatting object are present on each of its generated areas, and with the same value. (However, see sections 4.7.2 Line-building and 4.9.4 Border, Padding, and Background.) The id trait is computed for formatting objects but is not present on areas.
As described above, the content-rectangle is the rectangle bounding the inside of the padding and is used to describe the constraints on the positions of descendant areas. It is possible that marks from descendant glyphs or other areas may appear outside the content-rectangle.
Related to this is the allocation-rectangle of an area, which is used to describe the constraints on the position of the area within its parent area. For an inline-area this is either the normal-allocation-rectangle or the large-allocation-rectangle. The normal-allocation-rectangle extends to the content-rectangle in the block-progression-direction and to the border-rectangle in the inline-progression-direction. The large-allocation-rectangle is the border-rectangle. Unless otherwise specified, the allocation-rectangle for an area is the normal-allocation-rectangle.
Normal-allocation-rectangle of an inline-area
Large-allocation-rectangle of an inline-area
For a block-area, the allocation-rectangle extends to the border-rectangle in the block-progression-direction and outside the content-rectangle in the inline-progression-direction by an amount equal to the end-indent, and in the opposite direction by an amount equal to the start-indent.
Note:
The inclusion of space outside the border-rectangle of a block-area in the inline-progression-direction does not affect placement constraints, and is intended to promote compatibility with the CSS box model.
Allocation- and content-rectangles of a block-area
The edges of a rectangle are designated as follows:
the before-edge is the edge occurring first in the block-progression-direction and perpendicular to it;
the after-edge is the edge opposite the before-edge;
the start-edge is the edge occurring first in the inline-progression-direction and perpendicular to it,
the end-edge is the edge opposite the start-edge.
For purposes of this definition, the content-rectangle of an area uses the inline-progression-direction and block-progression-direction of that area; but the border-rectangle, padding-rectangle, and allocation-rectangle use the directions of its parent area. Thus the edges designated for the content-rectangle may not correspond to the same-named edges on the padding-, border-, and allocation-rectangles. This is important in the case of nested areas with different writing-modes or reference-orientation.
The following diagram shows the correspondence between the various edge names for a mixed writing-mode example:
Each inline-area has an alignment-point determined by the formatter, on the start-edge of its allocation-rectangle; for a glyph-area, this is a point on the start-edge of the glyph on its alignment baseline (see below). This is script-dependent and does not necessarily correspond to the (0,0) coordinate point used for the data describing the glyph shape.
In the area tree, the set of areas with a given parent is ordered. The terms initial, final, preceding, and following refer to this ordering.
In any ordered tree, this sibling order extends to an ordering of the entire tree in at least two ways.
In the pre-order traversal order of a tree, the children of each node (their order unchanged relative to one another) follow the node, but precede any following siblings of the node or of its ancestors.
In the post-order traversal order of a tree, the children of each node precede the node, but follow any preceding siblings of the node or of its ancestors.
"Preceding" and "following", when applied to non-siblings, will depend on the extension order used, which must be specified. However, in either of these given orders, the leaves of the tree (nodes without children) are unambiguously ordered.
This section defines the notion of block-stacking constraints and inline-stacking constraints involving areas. These are defined as ordered relations, i.e., if A and B have a stacking constraint it does not necessarily mean that B and A have a stacking constraint. These definitions are recursive in nature and some cases may depend upon simpler cases of the same definition. This is not circularity but rather a consequence of recursion. The intention of the definitions is to identify areas at any level of the tree which may have only space between them.
The area-class trait is an enumerated value which is
xsl-normal for an area which is stacked with
other areas in sequence. A normal area is an
area for which this trait is xsl-normal. A
page-level-out-of-line
area is an area with area-class xsl-footnote,
xsl-before-float,
or xsl-fixed; placement of these areas is controlled
by the fo:page-sequence
ancestor of its generating formatting object. A reference-level-out-of-line
area is an area with area-class
xsl-side-float or xsl-absolute;
placement of these areas is controlled by the formatting object generating
the relevant reference-area. An anchor
area is an area with area-class
xsl-anchor;
placement of these areas is arbitrary and does not affect stacking.
Areas with area-class equal to one of
xsl-normal,
xsl-footnote, or
xsl-before-float are defined to be
stackable,
indicating that they are supposed to be properly stacked.
Block-stacking constraints
If P is a block-area, then there is a fence preceding P if P is a reference-area or if the border-before-width or padding-before-width of P are non-zero. Similarly, there is a fence following P if P is a reference-area or if the border-after-width or padding-after-width of P are non-zero.
If A and B are stackable areas, and S is a sequence of space-specifiers (see 4.3 Spaces and Conditionality), it is defined that A and B have block-stacking constraint S if any of the following conditions holds:
B is a block-area which is the first normal child of A, and S is the sequence consisting of the space-before of B.
A is a block-area which is the last normal child of B, and S is the sequence consisting of the space-after of A.
A and B are both block-areas, and either
a. B is the next stackable sibling area of A, and S is the sequence consisting of the space-after of A and the space-before of B;
b. B is the first normal child of a block-area P, B is not a line-area, there is no fence preceding P, A and P have a block-stacking constraint S', and S consists of S' followed by the space-before of B; or
c. A is the last normal child of a block-area P, A is not a line-area, there is no fence following P, P and B have a block-stacking constraint S'', and S consists of the space-after of A followed by S''.
d. A has a block-stacking constraint S' with a block-area E, E has a block-stacking constraint S'' with B, E is empty (i.e., it has zero border, padding, and block-progression-dimension, and no normal children), and S consists of S' followed by S''.
Note:
The use of "stackable" in two places in the above definition allows