W3C

Extensible Stylesheet Language (XSL) Version 1.1

W3C Recommendation 05 December 2006

This version:
http://www.w3.org/TR/2006/REC-xsl11-20061205/
Latest version:
http://www.w3.org/TR/xsl11/
Previous version:
http://www.w3.org/TR/2006/PR-xsl11-20061006/
Editor:
Anders Berglund, IBM <alrb@us.ibm.com>

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.


Abstract

This specification defines the features and syntax for the Extensible Stylesheet Language (XSL), a language for expressing stylesheets. It consists of two parts:

  1. a language for transforming XML documents (XSLT), and

  2. 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.

Status of this Document

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.

Table of Contents

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

Appendices

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)