<?xml version="1.0" encoding="utf-8"?>
<spec>
<header>
<title>Extensible Stylesheet Language (XSL)</title>
<version>Version 1.0</version>
<w3c-designation>xsl-20000327</w3c-designation>
<w3c-doctype>W3C Working Draft</w3c-doctype>
<pubdate><day>27</day><month>March</month><year>2000</year></pubdate>
<publoc>
<loc href="http://www.w3.org/TR/2000/WD-xsl-20000327/" show="replace" actuate="user" xmlns:xlink="http://www.w3.org/TR/WD-xlink">http://www.w3.org/TR/2000/WD-xsl-20000327/</loc>
<otherversions>
<loc href="http://www.w3.org/TR/2000/WD-xsl-20000327/xslspec.xml" show="replace" actuate="user" xmlns:xlink="http://www.w3.org/TR/WD-xlink">XML file</loc>,
<loc href="http://www.w3.org/TR/2000/WD-xsl-20000327/xslspec.html" show="replace" actuate="user" xmlns:xlink="http://www.w3.org/TR/WD-xlink">HTML (one large file)</loc>,
<loc href="http://www.w3.org/TR/2000/WD-xsl-20000327/xs000327.zip" show="replace" actuate="user" xmlns:xlink="http://www.w3.org/TR/WD-xlink">ZIP file</loc>
</otherversions>

</publoc>
<latestloc>
<loc href="http://www.w3.org/TR/xsl/" show="replace" actuate="user" xmlns:xlink="http://www.w3.org/TR/WD-xlink">http://www.w3.org/TR/xsl/</loc>
</latestloc>
<prevlocs>
<loc href="http://www.w3.org/TR/2000/WD-xsl-20000301" show="replace" actuate="user" xmlns:xlink="http://www.w3.org/TR/WD-xlink">http://www.w3.org/TR/2000/WD-xsl-20000301</loc>
</prevlocs>
<authlist>
<author>
<name>Sharon Adler</name>
<affiliation>IBM</affiliation>
<email href="mailto:sca@us.ibm.com" show="new" actuate="user" xmlns:xlink="http://www.w3.org/TR/WD-xlink">sca@us.ibm.com</email>
</author>
<author>
<name>Anders Berglund</name>
<affiliation>IBM</affiliation>
<email href="mailto:alrb@us.ibm.com" show="new" actuate="user" xmlns:xlink="http://www.w3.org/TR/WD-xlink">alrb@us.ibm.com</email>
</author>
<author>
<name>Jeff Caruso</name>
<affiliation>Bitstream</affiliation>
<email href="mailto:jcaruso@bitstream.com" show="new" actuate="user" xmlns:xlink="http://www.w3.org/TR/WD-xlink">jcaruso@bitstream.com</email>
</author>
<author>
<name>Stephen Deach</name>
<affiliation>Adobe</affiliation>
<email href="mailto:sdeach@adobe.com" show="new" actuate="user" xmlns:xlink="http://www.w3.org/TR/WD-xlink">sdeach@adobe.com</email>
</author>
<author>
<name>Paul Grosso</name>
<affiliation>ArborText</affiliation>
<email href="mailto:paul@arbortext.com" show="new" actuate="user" xmlns:xlink="http://www.w3.org/TR/WD-xlink">paul@arbortext.com</email>
</author>
<author>
<name>Eduardo Gutentag</name>
<affiliation>Sun</affiliation>
<email href="mailto:eduardo.gutentag@eng.sun.com" show="new" actuate="user" xmlns:xlink="http://www.w3.org/TR/WD-xlink">eduardo.gutentag@eng.sun.com</email>
</author>
<author>
<name>Alex Milowski</name>
<affiliation>Lexica</affiliation>
<email href="mailto:alex@milowski.com" show="new" actuate="user" xmlns:xlink="http://www.w3.org/TR/WD-xlink">alex@milowski.com</email>
</author>
<author>
<name>Scott Parnell</name>
<affiliation>Xerox</affiliation>
<email href="mailto:Scott.Parnell@usa.xerox.com" show="new" actuate="user" xmlns:xlink="http://www.w3.org/TR/WD-xlink">Scott.Parnell@usa.xerox.com</email>
</author>
<author>
<name>Jeremy Richman</name>
<affiliation>Interleaf</affiliation>
<email href="mailto:jrichman@hq.ileaf.com" show="new" actuate="user" xmlns:xlink="http://www.w3.org/TR/WD-xlink">jrichman@hq.ileaf.com</email>
</author>
<author>
<name>Steve Zilles</name>
<affiliation>Adobe</affiliation>
<email href="mailto:szilles@adobe.com" show="new" actuate="user" xmlns:xlink="http://www.w3.org/TR/WD-xlink">szilles@adobe.com</email>
</author>
</authlist>

<status>

<p>This is a W3C Working Draft for review by W3C members and other
interested parties.

The XSL Working Group considers that this draft is stable and ready
to move to Candidate Recommendation status, following the successful
resolution of comments. This is therefore the
last call for comments on this Working Draft. Please send detailed
comments to <loc href="mailto:xsl-editors@w3.org" show="replace" actuate="user" xmlns:xlink="http://www.w3.org/TR/WD-xlink">xsl-editors@w3.org</loc> before 30
April 2000; <loc href="http://lists.w3.org/Archives/Public/xsl-editors" show="replace" actuate="user" xmlns:xlink="http://www.w3.org/TR/WD-xlink">archives</loc>
of the comments are available.
More general public discussion of XSL takes place on the <loc href="http://www.mulberrytech.com/xsl/xsl-list/index.html" show="replace" actuate="user" xmlns:xlink="http://www.w3.org/TR/WD-xlink">XSL-List</loc>
mailing list.</p>

<p>It is a draft document and may be
updated, replaced, or obsoleted by other documents at any time.  The
XSL Working Group will not allow early implementation to constrain its
ability to make changes to this specification prior to final release.
It is inappropriate to use W3C Working Drafts as reference material or
to cite them as other than <quote>work in progress</quote>. A list of
current W3C working drafts can be found at <loc href="http://www.w3.org/TR" show="replace" actuate="user" xmlns:xlink="http://www.w3.org/TR/WD-xlink">http://www.w3.org/TR</loc>.</p>

<p>This document has been produced as part of the <loc href="http://www.w3.org/Style/" show="replace" actuate="user" xmlns:xlink="http://www.w3.org/TR/WD-xlink">W3C Style Activity</loc> by
the <loc href="http://www.w3.org/Style/XSL/Group/" show="replace" actuate="user" xmlns:xlink="http://www.w3.org/TR/WD-xlink">XSL Working Group</loc>
(<loc href="http://cgi.w3.org/MemberAccess/" show="replace" actuate="user" xmlns:xlink="http://www.w3.org/TR/WD-xlink">members only</loc>).</p>



</status>

<abstract>

<p>XSL is a language for expressing stylesheets.  It consists of two
parts:</p>

<olist>

<item><p>a language for transforming XML documents, and</p></item>

<item><p>an XML vocabulary for specifying formatting
semantics.</p></item>

</olist>

<p>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.</p>

</abstract>

<langusage>
<language id="EN">English</language>
<language id="ebnf">EBNF</language>
</langusage>
<revisiondesc>
<slist>
<sitem>See RCS log for revision history.</sitem>
</slist>
</revisiondesc>
</header>
<body>


<div1><head>Introduction and Overview</head>
<p>
This specification defines the Extensible Stylesheet Language
(XSL). XSL is a language for expressing stylesheets. Given a class of
arbitrarily structured XML <bibref ref="XML"/>
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.
</p>
<div2><head>Processing a Stylesheet</head>
<p>
An XSL <term>stylesheet processor</term> 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 <term>tree transformation</term> and the
second
is called <term>formatting</term>. The process of formatting
is performed by the <term>formatter.</term> This formatter
may simply be a rendering engine inside a browser.
</p>
<p>
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.
</p>
<p>Formatting is enabled by including formatting semantics
in the result tree. Formatting semantics are
expressed in terms of a catalog of classes of
<term>formatting
objects.</term> 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 <term>formatting objects</term> and
<term>formatting properties</term>
provide the vocabulary for expressing presentation intent.
</p>
<p>
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.</p>
<graphic source="two-process.gif" xml:attributes="href source" show="embed" actuate="auto" xmlns:xlink="http://www.w3.org/TR/WD-xlink"/>
<div3><head>Tree Transformations</head>
<p>
Tree transformation constructs the result tree.  In XSL,
this tree is called the <term>element and attribute
tree,</term> 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
<bibref ref="XSLT"/>.
A diagram depicting this conceptual process is
shown below.</p>
<graphic source="tree1-2.gif" xml:attributes="href source" show="embed" actuate="auto" xmlns:xlink="http://www.w3.org/TR/WD-xlink"/>
<p>
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.
</p>
</div3>

<div3><head>Formatting</head>
<p>
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.
</p>
<p>
The vocabulary of formatting objects supported by XSL - the set of
<code>fo:</code> 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.
</p>
<p>
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.
</p>
<p>
Formatting consists of the generation of a tree
of geometric areas, called the <term>area tree</term>. 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.
</p>
<p>
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.
</p>
<p>
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 <term>formatting object tree</term>.
</p>
<graphic source="tree2-3.gif" xml:attributes="href source" show="embed" actuate="auto" xmlns:xlink="http://www.w3.org/TR/WD-xlink"/>
<p>
As part of the step of objectifying, the characters that occur in
the result tree are replaced by fo:character nodes.  The
first phase of the
Unicode Bidirectional Algorithm is used to convert implicit Bidirectional
mark-up to explicit nodes with the appropriate directional
properties. Care is taken to insure that the explicit nodes
so introduced
are properly nested in the formatting object tree.</p>
<p>
The second phase in formatting is to refine the formatting
object tree
to produce the <term>refined formatting object tree</term>.
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), and (4) inheritance. Details on
refinement are found in <specref ref="refinement"/>.
</p>
<p>The refinement step is depicted in the diagram below.
</p>
<graphic source="tree3-4.gif" xml:attributes="href source" show="embed" actuate="auto" xmlns:xlink="http://www.w3.org/TR/WD-xlink"/>
<p>
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.
</p>
<p>Area generation is depicted in the diagram below.
</p>
<graphic source="trees4-5.gif" xml:attributes="href source" show="embed" actuate="auto" xmlns:xlink="http://www.w3.org/TR/WD-xlink"/>
</div3>
</div2>
<div2><head>Benefits of XSL</head>
<p>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.
</p>
<p>
This document is intended for implementors of such XSL processors.
Although it can be used as a reference manual for writers of XSL
style sheets, it is not tutorial in nature. </p>
<p>
XSL builds on the prior work on Cascading Style Sheets
<bibref ref="CSS2"/> and
the Document Style Semantics and Specification Language
<bibref ref="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.
</p><div3><head>Paging and Scrolling</head>
<p>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 side-bars, 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.</p>
<p>
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. 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, thus providing the
user with an extremely powerful selection mechanism. </p>
<p>
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.
</p><p>
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.
</p><p>
In other cases, common properties that are expressed in CSS2
as one property with multiple simultaneous values, are 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 "space-treatment" property that
controls how white-space is processed, a "line-feed" 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.
</p><p>
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).
</p><p>
Some of the formatting objects and many of the properties in XSL
come from the CSS2 specification, ensuring compatibility
between the two.</p>
<p>
There are four classes of XSL properties that can be identified as:</p>
<olist><item><p>
CSS properties by copy (unchanged from their CSS2
semantics)</p></item>
<item><p>
CSS properties with extended values</p></item>
<item><p>
CSS properties broken apart and/or extended</p></item>
<item><p>
XSL only properties</p></item></olist>
</div3>
<div3><head>Selectors and Tree Construction</head>
<p>
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.
</p><p>
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.
</p></div3>
<div3><head>An Extended Page Layout Model</head>
<p>
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 side-bars; how big are these)
and the rules by which the XML source content is placed into these "containers".
</p><p>
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 side-bars
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.
</p><p>
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.
</p></div3>
<div3><head>A Comprehensive Area Model</head>
<p>
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 <specref ref="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
<specref ref="cssbox"/>.
The area model provides a vocabulary for describing
the relationships and space-adjustment between
letters, words, lines, and blocks.</p>
</div3>
<div3><head>Internationalization and Writing-Modes</head>
<p>
There are many 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 the languages based on these scripts.
</p><p>
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 <specref ref="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.
</p><p>
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 sub- and super-scripts), etc.
</p></div3>
<div3><head>Linking</head>
<p>
Because XML, unlike HTML, has no built-in semantics,
there is no built-in notion of a hypertext link. 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.</p>
<p>
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.</p>
<p>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.</p>
</div3>
</div2>
</div1>


<div1><head>Introduction to XSL Transformation</head>
<div2>
<head>Tree Construction</head>
<p>The Tree Construction is described in
"XSL Transformations" <bibref ref="XSLT"/>.</p>
<p>The provisions in "XSL Transformations" form an integral part of
this recommendation and are considered normative.</p>
</div2>

<div2 id="xsl-namespace">
<head>XSL Namespace</head>

<p>The XSL namespace has the URI <code>http://www.w3.org/1999/XSL/Format</code>.</p>
<note><p>The <code>1999</code> 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.</p></note>
<p>XSL processors must use the XML namespaces mechanism <bibref ref="XMLNAMES"/> 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.</p>
<p>This specification uses the prefix <code>fo:</code> 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.</p>
<p>An element from the XSL namespace may have any attribute not from
the XSL namespace, provided that the <xtermref href="http://www.w3.org/TR/xpath#dt-expanded-name" show="new" actuate="user" xmlns:xlink="http://www.w3.org/TR/WD-xlink">expanded-name</xtermref> 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. 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.</p>
<p>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 for the element in this document.</p>
<note><p>The conventions used for the names of XSL elements,
attributes, and functions are as follows:
names are all lower-case,
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.</p></note>

</div2>

</div1>


<div1 id="fo-jc-intro"><head>Introduction to
Formatting</head>
<p>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.</p>
<p><emph>Formatting</emph> 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
<term>area tree</term>, 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
<emph>traits</emph>, which are to areas what properties are to formatting objects
and attributes are to XML nodes. Section 4 (see <specref ref="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.
</p>
<p><emph>Formatting objects</emph> are elements in the formatting object tree, whose
names are from the XSL namespace; a formatting object belongs to a
<emph>class</emph> 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. Sections 6 (see <specref ref="fo-section"/>) and
Section 7
(see <specref ref="pr-section"/>
describe formatting objects and their properties.</p>
<p>Some formatting objects are <emph>block-level</emph> and others are
<emph>inline-level</emph>. 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
Section 4 for detailed decriptions of these area types and
directions.</p>
<p>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.</p>
<p>Central to this model of formatting is <emph>refinement</emph>.
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</p>
<ulist><item><p>propagating the various inherited values
of properties (both implicitly and those with an attribute value of "inherit"),
</p></item>
<item><p>evaluating expressions in property value specifications into actual
values, which
are then used to determine the value of the properties</p></item>
<item><p>converting relative numerics to absolute numerics,</p></item>
<item><p>constructing some composite properties from more than one attribute,</p></item>
</ulist>
<p>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 Section 5.
See (see <specref ref="refinement"/>).</p>
<p>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.</p>
<div2><head>Conceptual Procedure</head>
<p>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.</p>
<p>The procedure works by processing formatting objects. Each object,
while being processed, may initiate processing in 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.</p>
<p>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, it
resumes control later and initiates 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.</p>
<p>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.</p>
<p>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.</p>
<p>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.</p>
<p>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.</p>
<p>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.</p>
</div2>
</div1>




<div1 id="area_model"><head>Area Model</head>
<p>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 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.</p>
<div2 id="area-intro"><head>Introduction</head>
<p>The formatter generates an ordered tree, the <term>area tree,</term> which
describes a geometric structuring of the output medium. The terms
<term>child, sibling, parent, descendant,</term> and <term>ancestor</term>
refer to this tree structure. The tree has a <term>root node</term>.</p>
<p>Each area tree node other than the root is called an <term>area</term> 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.</p>
<note><p>The only exceptions 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
<trait>font-family</trait> and <trait>font-size</trait> are the same for
all the generating formatting objects (see section <specref ref="area-linebuild"/>).</p></note>
<p>An area has a <term>content-rectangle</term>,
the portion in which its child areas are assigned, and optional
<term>padding</term> and <term>border</term>. The diagram shows
how these portions are related to one another. The outer bound of the border
is called the <term>border-rectangle</term>, and the outer
bound of the
padding is called the <term>padding-rectangle</term>.</p>
<graphic source="Image1.gif" xml:attributes="href source" show="embed" actuate="auto" xmlns:xlink="http://www.w3.org/TR/WD-xlink"/>
<p>Each area has a set of <term>traits</term>, 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 <term>formatting traits</term>, and traits used for
rendering may be called <term>rendering traits</term>.
Traits whose values are copied from property of the same or a corresponding
name are listed in <specref ref="property-index"/> and <specref ref="refinement"/>;
other traits are listed
in <specref ref="area-traitlist"/>.</p>
<p>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.)</p>
<p>The traits of an area are either:</p>
<p>1. "directly-derived" -- The values of directly-derived traits are the computed
value of a property of the same name on the generating formatting object, or</p>
<p>2. "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.</p>
<p>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 <specref ref="refinement"/>. This
allows the
process of inheritance to be described once and avoids a need to repeat
information on computing values
in this description.</p>
</div2>
<div2 id="area-rect"><head>Rectangular Areas</head>
<div3><head>Area Types</head>
<p>There are two types of areas: <term>block-areas</term> and
<term>inline-areas</term>. 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.</p>
<p>A <term>line-area</term> is a special kind of block-area whose children
are all inline-areas. A <term>glyph-area</term> is a special kind of
inline-area which has no child areas, and has a single
glyph image as its content.</p>
<p>Typical examples would be: 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).</p>
</div3>
<div3 id="area-common"><head>Common Traits</head>
<p>Associated with any area are two directions, which are derived from the
generating
formatting object's <trait>writing-mode</trait> and
<trait>reference-orientation</trait> properties: the
<term>block-progression-direction</term> is the direction for stacking block-area
descendants of the area, and the
<term>inline-progression-direction</term> is the direction for stacking inline-area
descendants of the area. Another
trait, the <term>shift-direction</term>, is present on inline-areas and refers to
the direction in which baseline
shifts are applied. Also the <term>glyph-orientation</term> defines the orientation
of glyph-images in the rendered result.</p>
<p>The Boolean trait <term>is-reference-area</term> determines
whether or not an area establishes a coordinate system for
specifying indents. An area for which this trait is <code role="value">true</code>
is called a <term>reference-area</term>.
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.</p>

<p>The Boolean trait <term>is-viewport-area</term> 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 <code role="value">true</code>
is called a <term>viewport-area</term>.
</p>
<p>A common construct is a <term>viewport/reference pair</term>.
This is a block-area viewport-area <var>V</var> and a block-area
reference-area <var>R</var>, where <var>R</var> is the sole child
of <var>V</var> and where the start-edge and end-edge of the
content-rectangle of <var>R</var> coincide with the start-edge and
end-edge of the content-rectangle of <var>V</var>.</p>

<p>Each element has the traits <term>top-position</term>, <term>bottom-position</term>,
<term>left-position</term>, and <term>right-position</term> 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 <code role="value">fixed</code>); the <term>left-offset</term>
and <term>top-offset</term> 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.</p>
<p>The <term>block-progression-dimension</term> and
<term>inline-progression-dimension</term> of an area represent the
extent of the content-rectangle of that area in each of the two
relative dimensions</p>

<p>Other traits include:</p>
<ulist><item>
<p>the <term>is-first</term> and <term>is-last</term> traits, which are Boolean traits
indicating the order in which areas are generated and returned by a given
formatting object. <term>is-first</term> is <code role="value">true</code>
for the first area (or only area) generated and returned by a formatting object,
and <term>is-last</term>
is true for the last area (or only area).</p></item>
<item>
<p>the amount of space outside the border-rectangle: <term>space-before</term>,
<term>space-after</term>, <term>space-start</term>, and <term>space-end</term>
(though some of these may be required to be zero on certain classes of area);</p></item>
<item><p>the thickness of each of the four sides of the padding: <term>padding-before</term>,
<term>padding-after</term>, <term>padding-start</term>, and <term>padding-end</term>;</p></item>
<item><p>the style, thickness, and color of each of the
four sides of the border: <term>border-before</term>, etc.; and</p></item>
<item><p>the background rendering of the
area: <term>background-color</term>, <term>background-image</term>, and
other background traits.</p>
<note><p>"Before", "after", "start",
and "end" refer to relative directions and are defined
below.</p></note>
</item><item>
<p>a set of font traits (see "Common Font Properties")
which determine the <term>nominal-font</term> that is deemed to be used
within that area.</p></item>
</ulist>
<p>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
<specref ref="area-linebuild"/> and <specref ref="rend-border"/>.)</p>
</div3>
<div3 id="area-geo"><head>Geometric Definitions</head>
<p>As described above, the <term>content-rectangle</term> 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 glyph contents or descendant areas may appear outside the
content-rectangle.</p>
<p>Related to this is the <term>allocation-rectangle</term>
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 extends
to the content-rectangle
in the block-progression-direction and to the border-rectangle in the
inline-progression-direction.</p>
<figure>
<graphic source="Image2.gif" xml:attributes="href source" show="embed" actuate="auto" xmlns:xlink="http://www.w3.org/TR/WD-xlink"/>
<figcap><p>Allocation- and content-rectangles of an inline-area</p></figcap>
</figure>
<p>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.</p>
<note><p>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.</p></note>
<figure>
<graphic source="Image3.gif" xml:attributes="href source" show="embed" actuate="auto" xmlns:xlink="http://www.w3.org/TR/WD-xlink"/>
<figcap><p>Allocation- and content-rectangles of a block-area</p></figcap>
</figure>
<p>The edges of a rectangle are designated as follows:</p>
<ulist><item>
<p>the <term>before-edge</term> is the edge occurring first in the
block-progression-direction and perpendicular
to it;</p></item>
<item><p>the <term>after-edge</term> is the edge opposite
the before-edge;</p></item>
<item><p>the <term>start-edge</term> is the edge occurring
first in the inline-progression-direction and perpendicular
to it,</p></item>
<item><p>the <term>end-edge</term> is the edge opposite the
start-edge.</p></item></ulist>
<p>The following diagram shows the correspondence between the various edge
names for a mixed writing-mode example:</p>
<graphic source="japaneseblock3.gif" xml:attributes="href source" show="embed" actuate="auto" xmlns:xlink="http://www.w3.org/TR/WD-xlink"/>

<p>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 with the same-named edges
on the padding-, border-,
and allocation-rectangles. This is important in the case of
nested block-areas with different writing-modes.</p>
<p>Each inline-area has a <term>position-point</term> determined by the formatter,
on the start-edge
of its allocation-rectangle; for a glyph-area, this is
a point on the leading edge of the glyph on its preferred 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.</p>
</div3>
<div3 id="area-treeorder"><head>Tree Ordering</head>
<p>In the area tree, the set of areas with a given parent is ordered.
The terms <term>initial, final, preceding</term>, and
<term>following</term> refer to this ordering.</p>

<p>In any ordered tree, this sibling order extends to an ordering of the entire tree
in at least two ways.</p>
<ulist><item><p>In the <term>pre-order traversal order</term> 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.</p></item>
<item><p>In the <term>post-order traversal order</term> of a tree, the children of
each node precede the node, but follow any preceding siblings of the node or of its
ancestors.</p></item></ulist>
<p>"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.</p>
</div3>

<div3 id="area-stackcon"><head>Stacking Constraints</head>
<p>This section defines the notion of <term>block-stacking constraints</term> and
<term>inline-stacking constraints</term> involving areas.  These are defined as
ordered relations, i.e., if <var>A</var> and <var>B</var>
have a stacking constraint
it does not necessarily mean that <var>B</var> and <var>A</var> have a stacking
constraint.</p>
<p>The <term>area-class</term> trait is an enumerated value which is
<code role="value">xsl-normal</code> for an area which is stacked with
other areas in sequence.  A <term>normal</term> area is an
area for which this trait is <code role="value">xsl-normal</code>. A
<term>page-level-out-of-line</term>
area is an area with area-class <code role="value">xsl-footnote</code>,
<code role="value">xsl-before-float</code>,
or <code role="value">xsl-fixed</code>; placement of these areas is controlled
by the fo:page-sequence
ancestor of its generating formatting object.  A <term>reference-level-out-of-line</term>
area is an area with area-class
<code role="value">xsl-side-float</code> or <code role="value">xsl-absolute</code>;
placement of these areas is controlled by the formatting object generating
the relevant reference-area.  Areas with area-class equal to one of
<code role="value">xsl-normal</code>,
<code role="value">xsl-footnote</code>, or
<code role="value">xsl-before-float</code> are defined to be
<term>stackable</term>,
indicating that they are supposed to be properly stacked.
</p>
<p>If <var>P</var> is a block-area, then there is a <term>fence-before</term>
<var>P</var> if <var>P</var> is a reference-area or if the
border-before-width
or padding-before-width of <var>P</var> are non-zero.
Similarly, there is a
<term>fence-after</term> <var>P</var> if <var>P</var> is a
reference-area
or if the border-after-width or padding-after-width of <var>P</var> are non-zero.</p>
<p>If <var>A</var> and <var>B</var> are stackable areas, and <var>S</var> is
a sequence of space-specifiers, it is defined that <term><var>A</var> and <var>B</var>
have block-stacking constraint <var>S</var></term> if
any of the following conditions holds:</p>
<olist>
<item><p><var>B</var> is a block-area which is the first normal
child of <var>A</var>, and <var>S</var> is the sequence consisting of the
space-before of <var>B</var>.</p></item>
<item><p><var>A</var> is a block-area which is the last normal
child of <var>B</var>, and <var>S</var> is the sequence consisting of the
space-after of <var>A</var>.</p></item>
<item><p><var>A</var> and <var>B</var> are both block-areas, and either</p>
    <p>a. <var>B</var> is the next stackable sibling area of <var>A</var>,
    and <var>S</var> is the sequence consisting of the space-after of <var>A</var>
    and the space-before of <var>B</var>;</p>
    <p>b. <var>B</var> is the first normal child of a block-area
    <var>P</var>, there is no fence-before <var>P</var>,
<var>A</var> and
    <var>P</var> have a block-stacking constraint <var>S</var>', and <var>S</var>
    consists of <var>S</var>' followed by the space-before of <var>B</var>; or</p>
    <p>c. <var>A</var> is the last normal child of a block-area
    <var>P</var>, there is no fence-after <var>P</var>,
<var>P</var> and
    <var>B</var> have a block-stacking constraint <var>S</var>'', and <var>S</var>
    consists of the space-after of <var>A</var> followed by <var>S</var>''.</p></item>
</olist>
<figure>
<graphic source="block-stacking-constraints.gif" xml:attributes="href source" show="embed" actuate="auto" xmlns:xlink="http://www.w3.org/TR/WD-xlink"/>
<figcap><p>Adjacent Edges with Block-stacking</p></figcap>
</figure>
<note><p>The use of "stackable" in two places in the above definition allows
block-stacking constraints to apply between areas of area-class
<code role="value">xsl-before-float</code>
or <code role="value">xsl-footnote</code>.</p></note>
<p>When <var>A</var> and <var>B</var> have a block-stacking constraint, the
<term>adjacent edges</term> of <var>A</var> and <var>B</var> are an ordered
pair recursively defined as:</p>
<ulist><item><p>In case 1, the before-edge of the
content-rectangle of <var>A</var>
and the before-edge of the allocation-rectangle of <var>B</var>.</p></item>
<item><p>In case 2, the after-edge of the content-rectangle
of <var>A</var> and
the after-edge of the allocation-rectangle of <var>B</var>.</p></item>
<item><p>In case 3a, the after-edge of the
allocation-rectangle of <var>A</var>
and the before-edge of the allocation-rectangle of <var>B</var>.</p></item>
<item><p>In case 3b, the first of the adjacent edges of <var>A</var> and <var>P</var>,
and the before-edge of the allocation-rectangle of <var>B</var>.</p></item>
<item><p>In case 3c, the after-edge of the
allocation-rectangle of <var>A</var>
and the second of the adjacent edges of <var>P</var> and <var>B</var>.</p></item></ulist>

<note><p>The intention of the definition is to identify areas at any level of the
tree which have only space between them.</p></note>

<figure>
<graphic source="mantree.gif" xml:attributes="href source" show="embed" actuate="auto" xmlns:xlink="http://www.w3.org/TR/WD-xlink"/>
<figcap><p>Block-stacking constraint example</p></figcap>
</figure>

<p><emph>Example</emph>. In this diagram each node represents a block-area.

Assume that all padding
and border widths are zero, and none of the areas are
reference-areas. Then <var>P</var>
and <var>A</var> have a block-stacking constraint, as do <var>A</var>
and <var>B</var>, <var>A</var> and

<var>C</var>, <var>B</var> and <var>C</var>, <var>C</var> and <var>D</var>,
<var>D</var> and <var>B</var>,
<var>B</var> and

<var>E</var>, <var>D</var> and

<var>E</var>, and <var>E</var> and

<var>P</var>; these

are the only pairs  in the diagram having block-stacking constraints. If

<var>B</var> had non-zero padding-after, then <var>D</var>

and <var>E</var> would not have any block-stacking constraint (though <var>B</var>

and <var>E</var> would continue to have a block-stacking constraint).</p>

<p><emph>Inline-stacking constraints.</emph> This section will recursively define the
inline-stacking constraints between two inline-areas,
together with the notion of
fence-before and fence-after; these definitions are interwoven with one another.
This parallels the definition for block-stacking
constraints, but with the additional complication that we may have a stacking
constraint between inline-areas which are stacked in opposite inline-progression-directions.
(This is not an issue for block-stacking constraints because
a block-area which is not a reference-area may not have
block-progression-direction
different from that of its parent.)</p>
<p>If <var>P</var> and <var>Q</var> have an inline-stacking constraint, then
<var>P</var> has a <term>fence-before <var>Q</var></term> if <var>P</var> is
a reference-area or has non-zero border-width or padding-width at the first
adjacent edge of <var>P</var> and <var>Q</var>. Similarly, <var>Q</var> has
a <term>fence-after <var>P</var></term> if <var>Q</var> is a reference-area
or has non-zero border-width or padding-width at the second
adjacent edge of
<var>P</var> and <var>Q</var>.</p>
<p>If <var>A</var> and <var>B</var> are normal inline-areas, and <var>S</var>
is a sequence of space-specifiers, it is defined that <term><var>A</var> and
<var>B</var> have inline-stacking constraint <var>S</var></term> if any of the
following conditions holds:</p>
<olist>
<item><p><var>B</var> is an inline-area which is the first normal child of
<var>A</var>, and <var>S</var> is the sequence consisting of the space-start of
<var>B</var>.</p></item>
<item><p><var>A</var> is an inline-area which is the last normal child of
<var>B</var>, and <var>S</var> is the sequence consisting of the space-end of
<var>A</var>.</p></item>
<item><p><var>A</var> and <var>B</var> are both inline-areas, and either</p>
    <p>a. <var>B</var> is the next normal sibling area of <var>A</var>,
    and <var>S</var> is the sequence consisting of the space-end of <var>A</var>
    and the space-start of <var>B</var>;</p>
    <p>b. <var>B</var> is the first normal child of an inline-area <var>P</var>,
	      <var>P</var> has no fence-after <var>A</var>,
<var>A</var> and <var>P</var> have an
		  inline-stacking constraint <var>S</var>', the inline-progression-direction of
		  <var>P</var> is the same as the inline-progression-direction of the nearest
		  common ancestor area of <var>A</var> and <var>P</var>, and <var>S</var> consists of
		  <var>S</var>' followed by the space-start of <var>B</var>.</p>
    <p>c. <var>A</var> is the last normal child of a block-area <var>P</var>,
	      <var>P</var> has no fence-before <var>B</var>,
<var>P</var> and <var>B</var> have an
		  inline-stacking constraint <var>S</var>'', the inline-progression-direction of
		  <var>P</var> is the same as the inline-progression-direction of the nearest
		  common ancestor area of <var>A</var> and <var>P</var>, and <var>S</var> consists of the
		  space-end of <var>A</var> followed by <var>S</var>''.</p>
    <p>d. <var>B</var> is the last normal child of an inline-area <var>P</var>,
	      <var>P</var> has no fence-after <var>A</var>,
<var>A</var> and <var>P</var> have an
		  inline-stacking constraint <var>S</var>', the inline-progression-direction of
		  <var>P</var> is opposite to the inline-progression-direction of the nearest
		  common ancestor area of <var>A</var> and <var>P</var>, and <var>S</var> consists of
		  <var>S</var>' followed by the space-end of <var>B</var>.</p>
    <p>e. <var>A</var> is the first normal child of a block-area <var>P</var>,
	      <var>P</var> has no fence-before <var>B</var>,
<var>P</var> and <var>B</var> have an
		  inline-stacking constraint <var>S</var>'', the inline-progression-direction of
		  <var>P</var> is opposite to the inline-progression-direction of the nearest
		  common ancestor area of <var>A</var> and <var>P</var>, and <var>S</var> consists of the
		  space-start of <var>A</var> followed by <var>S</var>''.</p>
</item>
</olist>
<figure>
<graphic source="inline-stacking1.gif" xml:attributes="href source" show="embed" actuate="auto" xmlns:xlink="http://www.w3.org/TR/WD-xlink"/>
<figcap><p>Adjacent Edges with Inline-stacking 1.</p></figcap>
</figure>
<figure>
<graphic source="inline-stacking2.gif" xml:attributes="href source" show="embed" actuate="auto" xmlns:xlink="http://www.w3.org/TR/WD-xlink"/>
<figcap><p>Adjacent Edges with Inline-stacking 2.</p></figcap>
</figure>
<graphic source="inline-stacking3.gif" xml:attributes="href source" show="embed" actuate="auto" xmlns:xlink="http://www.w3.org/TR/WD-xlink"/>
<graphic source="inline-stacking4.gif" xml:attributes="href source" show="embed" actuate="auto" xmlns:xlink="http://www.w3.org/TR/WD-xlink"/>

<p>When <var>A</var> and <var>B</var> have an inline-stacking constraint,
the <term>adjacent edges</term> of <var>A</var> and <var>B</var> are an ordered
pair defined as:</p>
<ulist><item><p>In case 1, the start-edge of the
content-rectangle of <var>A</var>
and the start-edge of the allocation-rectangle of <var>B</var>.</p></item>
<item><p>In case 2, the end-edge of the content-rectangle of <var>A</var> and
the end-edge of the allocation-rectangle of <var>B</var>.</p></item>
<item><p>In case 3a, the end-edge of the
allocation-rectangle of <var>A</var> and
the start-edge of the allocation-rectangle of <var>B</var>.</p></item>
<item><p>In case 3b, the first of the adjacent edges of <var>A</var> and
<var>P</var>, and the start-edge of the allocation-rectangle of <var>B</var>.</p></item>
<item><p>In case 3c, the end-edge of the
allocation-rectangle of <var>A</var>
and the second of the adjacent edges of <var>P</var> and <var>B</var>.</p></item>
<item><p>In case 3d, the first of the adjacent edges of <var>A</var> and
<var>P</var>, and the end-edge of the allocation-rectangle of <var>B</var>.</p></item>
<item><p>In case 3e, the start-edge of the
allocation-rectangle of <var>A</var>
and the second of the adjacent edges of <var>P</var> and <var>B</var>.</p></item></ulist>

<p>Two areas are <term>adjacent</term> if they have a block-stacking constraint
or an inline-stacking constraint. It follows from the definitions that areas of the same
type (inline or block) can be adjacent only if all their non-common ancestors
are also of the same type (up to but not including their nearest common ancestor).
Thus, for example, two inline-areas which reside in different line-areas are never
adjacent.</p>

<p>An area <var>A</var> <term>begins</term> an area <var>P</var> if <var>A</var> is a
descendant of <var>P</var> and <var>P</var> and <var>A</var> have either a
block-stacking constraint or an inline-stacking constraint. In this case the
second of the adjacent edges of <var>P</var> and <var>A</var> is defined to be
a <term>leading edge</term> in <var>P</var>. A space-specifier which applies to
the leading edge is also defined to <term>begin</term> <var>P</var></p>

<p>Similarly, An area <var>A</var> <term>ends</term> an area <var>P</var> if <var>A</var> is a
descendant of <var>P</var> and <var>A</var> and <var>P</var> have either a
block-stacking constraint or an inline-stacking constraint. In this case the
first of the adjacent edges of <var>A</var> and <var>P</var> is defined to be
a <term>trailing edge</term> in <var>P</var>. A space-specifier which applies to
the trailing edge is also defined to <term>end</term> <var>P</var></p>
</div3>
<div3 id="area-font"><head>Font Baseline Tables</head>
<p>Each script has its preferred "baseline" for aligning glyphs from that script.
Western scripts typically use a "alphabetic" baseline that touches at or near the
bottom of capital letters. Further, for each font there is a
preferred way of aligning embedded characters from different scripts, e.g., for a
Western font there is a separate baseline for aligning embedded ideographic or Indic
characters.</p>
<p>Each block-area and inline-area has a
<trait>dominant-baseline</trait> trait which is a
baseline-type, an enumerated type corresponding to the type of alignment expected
for the nominal font for that area. Similarly, each inline-area has
a <trait>baseline-identifier</trait> trait, corresponding to
the type of alignment preferred for
that area. The geometric line identified by this trait is called the
<term>preferred baseline</term>
of the inline-area.</p>
<p>Associated to each font is a table of baseline shifts, called the
<term>baseline table</term>, which associates to each pair of possible baseline types
the distance between the corresponding baselines in that font.</p>
<p><emph>Example</emph>.  For a Western font, the baseline table would
associate to the pair &lt;<code role="value">alphabetic</code>,
<code role="value">hanging</code>&gt; a distance
approximately equal to the ascent of the font, representing the offset
from the alphabetic baseline of the designated
alignment-point for embedded hanging-aligned characters.</p>
<p>Some font standards, e.g., OpenType, define a baseline
table as part of the font data.</p>
<p>Certain baselines which are not part of the registered set of baselines are defined
as follows.  The offset of the <code role="value">text-before-edge</code> baseline
is determined by the ascent of the nominal-font relative to the
dominant-baseline.
The <code role="value">text-after-edge</code>
baseline offset is defined to be the descent of the nominal-font.
</p>
<p>
For each line-area, the offset of the "before-edge" baseline is determined by ignoring
all inline-areas whose baseline-identifier is <code role="value">before-edge</code>.
The "before-edge" baseline
offset is set to the maximum extent in the direction opposite the block-progression-direction,
of the before-edges of the remaining inline-areas. If all
the inline-areas in a line-area are aligned "before-edge"
then use "text-before-edge" as the
"before-edge" alignment offset. The determination of the "after-edge" baseline is analogous.</p>
<p>For each area <term>before-baseline-height</term> and
<term>after-baseline-height</term> are defined to be the respective distances from
the area's
dominant-baseline to the before-edge and after-edge
baselines.  The <term>text-before-baseline-height</term> and the
<term>text-after-baseline-height</term> are defined to be the respective distances from
the area's
dominant-baseline to the text-before-edge and text-after-edge
baselines.</p>
</div3>
</div2>
<div2 id="spacecond"><head>Spaces and Conditionality</head>
<p>A space-specifier is a compound datatype whose components are minimum, optimum,
and maximum, conditionality, and precedence.</p>
<p><term>Minimum</term>, <term>optimum</term>, and <term>maximum</term> are lengths
and can be used to define a constraint
on a distance, namely that the distance should preferably be the optimum,
and in any case no less than the minimum nor more than the maximum. Any of these
values may be negative, which can (for
example) cause areas to overlap, but in any case the minimum should be less
than or equal to the optimum value, and the optimum less than or equal to
the maximum value.</p>
<p><term>Conditionality</term> is an enumerated value which controls whether a
space-specifier has effect at the beginning or end of a reference-area or a
line-area. Possible values are <code role="value">retain</code> and
<code role="value">discard</code>;
a <term>conditional</term> space-specifier is one for which this value is
<code role="value">discard</code>.</p>
<p><term>Precedence</term> has a value which is either an integer or the special
token <code role="value">force</code>. A <term>forcing</term> space-specifier
is one for which this value is <code role="value">force</code>.</p>
<p>Space-specifiers occurring in sequence may interact with each other. The
constraint imposed by a sequence of space-specifiers is computed by
calculating for each space-specifier
its associated <term>resolved space-specifier</term> in accordance with
their conditionality and precedence, as
shown below in the space-resolution rules.</p>
<p>The constraint imposed on a distance by a sequence of resolved space-specifiers
is additive; that is, the distance is constrained to be no less than the
sum of the resolved minimum values and no larger than the sum of the resolved
maximum values.</p>
<div3 id="area-space"><head>Space-resolution Rules</head>
<p>To compute the resolved space-specifier of a given space-specifier <var>S</var>,
consider the maximal inline-stacking constraint or block-stacking constraint
containing <var>S</var>. The resolved space-specifier of <var>S</var> is a
non-conditional space-specifier computed in terms of this sequence.</p>
<olist>
<item><p>If any of the space-specifiers (in the maximal sequence) is conditional,
and begins a reference-area or line-area, then it is <term>suppressed</term>,
which means that its resolved space-specifier is zero. Further, any conditional
space-specifiers which consecutively follow it in the sequence are also suppressed.</p>
<p>If a conditional space-specifier ends a reference-area or line-area, then it
is suppressed together with any other conditional space-specifiers which
consecutively precede it in the sequence.</p></item>
<item><p>If any of the remaining space-specifiers is forcing, all non-forcing
space-specifiers are suppressed, and the value of each of the forcing space-specifiers
is taken as its resolved value.</p></item>
<item><p>Alternatively if all of the remaining space-specifiers are non-forcing,
then the resolved space-specifier is defined in terms of those space-specifiers
whose precedence is numerically highest, and among these those whose optimum value is the
greatest. All other space-specifiers are suppressed. If there is only one of
these then its value is taken as its resolved value.</p>
<p>Otherwise, when there are at two or more space-specifiers all of the same highest
precedence and the same (largest) optimum, the resolved space-specifier of the
last space-specifier in the
sequence is derived from these spaces by taking their common optimum value as
its optimum, the greatest of their minimum values as its minimum,
and the least of their maximum values as its maximum, and all other space-specifiers
are suppressed.</p></item>
</olist>
<p><emph>Example</emph>. Suppose the sequence of space values occurring at the
beginning of a reference-areas is: first, a space with value 10 points (that is
minimum, optimum, and maximum all equal to 10 points) and conditionality
<code role="value">discard</code>; second, a space with value 4 points and
conditionality <code role="value">retain</code>; and third, a space
with value 5 points and conditionality <code role="value">discard</code>;
all three spaces having precedence zero. Then the first (10 point) space is
suppressed under rule 1, and the
second (4 point) space is suppressed under rule 3. The resolved value of the
third space is a non-conditional 5 points, even though
it originally came from a conditional space.</p>
<p>The padding of a block-area does not interact with the any space-specifier
(except that by definition, the presence of padding at the before- or after-edge
prevents areas on either side of it from having a stacking constraint.)</p>
<p>The border or padding at the before-edge or after-edge of a block-area may
be specified as conditional. If so, then it is set to zero if its associated
edge is a leading or trailing edge in a reference-area. In this case, the border
or padding is taken to be zero for purposes of the stacking constraint definitions.</p>
</div3>
</div2>
<div2 id="area-block"><head>Block-areas</head>
<p>Block-areas have several traits which typically affect the placement of their
children. The <term>line-height</term> is used in line placement calculations.
The <term>line-stacking-strategy</term> trait controls what kind of allocation
is used for descendant line-areas and has an enumerated value
(either <code role="value">font-height</code>, <code role="value">max-height</code>,
or <code role="value">line-height</code>). This is all rigorously described below.
All areas have these traits,
but they only have relevance for areas which have stacked line-area children.</p>
<p>The <term>space-before</term> and <term>space-after</term> determine the
distance between the block-area and surrounding block-areas.</p>
<p>A block-area which is not a line-area typically has its size in the
inline-progression-direction determined
by its start-indent and end-indent and by the size of its nearest ancestor
reference-area. A
block-area which is not a line-area typically varies its
block-progression-dimension
to accommodate its descendants. Alternatively the generating
formatting object may specify a
block-progression-dimension for the block-area.</p>
</div2>
<div2 id="area-stackblock"><head>Stacked Block-areas</head>
<p>Block-area children of an area are typically stacked in the
block-progression-direction
within their parent area, and this is the default method of
positioning block-areas. However, formatting objects
are free to specify other methods of positioning child areas of areas which
they generate, for example list-items or tables.</p>
<p>For a parent area <var>P</var> whose children are
block-areas, <var>P</var> is defined to be <term>properly
stacked</term> if all of the following conditions hold:</p>
<olist>
<item><p>For each block-area <var>B</var> which is a descendant of <var>P</var>,
the following hold:</p>
<ulist><item><p>the before-edge and after-edge
of its allocation-rectangle are parallel to the before-edge and after-edges of the
content-rectangle of <var>P</var>,</p></item>
<item>
<p>the start-edge of its allocation-rectangle is parallel to the start-edge
of the content-rectangle of <var>R</var> (where <var>R</var> is the closest
ancestor reference-area of <var>B</var>), and offset from it inward
by a distance equal to
the block-area's start-indent plus its
start-intrusion-adjustment, minus its border-start,
padding-start, and space-start values, and</p></item><item>
<p>the end-edge of its allocation-rectangle is parallel to the
end-edge
of the content-rectangle of <var>R</var>, and offset from it inward
by a distance equal to
the block-area's end-indent plus its
end-intrusion-adjustment,
minus its border-end, padding-end, and space-end
values.</p></item></ulist></item>
<item><p>For each pair of normal areas <var>B</var> and <var>B</var>'
in the subtree below <var>P</var>, if
<var>B</var> and <var>B</var>' have a block-stacking constraint <var>S</var>,
then the distance between the adjacent edges of <var>B</var> and <var>B</var>'
is consistent with the
constraint imposed by the
resolved values of the space-specifiers in <var>S</var>.</p></item>
</olist>
<graphic source="Image8.gif" xml:attributes="href source" show="embed" actuate="auto" xmlns:xlink="http://www.w3.org/TR/WD-xlink"/>
<note><p>The <trait>start-intrusion-adjustment</trait> and
<trait>end-intrusion-adjustment</trait> are traits used to
deal with intrusions from
floats in the inline-progression-direction. The notion of indent is intended to apply to the content-rectangle, but
the constraint is written in terms of the
allocation-rectangle, because as noted earlier the edges of the
content-rectangle may not
correspond to like-named edges of the
allocation-rectangle.</p></note>
<graphic source="spacebeforeafter.gif" xml:attributes="href source" show="embed" actuate="auto" xmlns:xlink="http://www.w3.org/TR/WD-xlink"/>
<p><emph>Example</emph>. In the diagram, if area
<var>A</var>
has a space-after value of 3 points, <var>B</var> a
space-before
of 1 point, and <var>C</var> a space-before of 2 points, all
with
precedence of <code role="value">force</code>, and with zero border and padding,
then the constraints will place <var>B</var>'s
allocation-rectangle
4 points below that of <var>A</var>, and <var>C</var>'s
allocation-rectangle
6 points below that
of <var>A</var>. Thus the 4-point gap receives the
background color
from <var>P</var>, and the 2-point gap before <var>C</var>
receives the background color from <var>B</var>.</p>
</div2>
<div2 id="area-line"><head>Line-areas</head>
<p>A line-area is a special type of block-area, and is generated by the same
formatting object which generated
its parent. Line-areas do not have borders and padding, i.e., border-before-width,
padding-before-width, etc. are all zero. Inline-areas are stacked within a line-area
relative to a <term>baseline-start-point</term> which is a point determined by the
formatter, on the start-edge of its content-rectangle.</p>
<p>The allocation-rectangle of a line is determined by the value of the
<trait>line-stacking-strategy</trait> trait: if the
value is <code role="value">font-height</code>, the allocation-rectangle is
the <term>nominal-requested-line-rectangle</term>, defined below; if the value is
<code role="value">max-height</code>, the allocation-rectangle is the
<term>maximum-line-rectangle</term>, defined below; and if
the value is
<code role="value">line-height</code>, the allocation-rectangle is the
<term>per-inline-height-rectangle</term>, defined below.</p>

<p>The <term>nominal-requested-line-rectangle</term> for a line-area is the rectangle
whose start-edge and end-edge are parallel to and coincident with the start-edge
and end-edge of the content-rectangle of the parent block-area (as modified by
typographic properties such as indents), whose before-edge is separated from the
baseline-start-point by the text-before-baseline-height, and whose after-edge is
separated from the baseline-start-point by the text-after-baseline-height. It has the
same block-progression-dimension for each line-area child of a block-area.</p>
<p>The <term>maximum-line-rectangle</term> for a line-area is the rectangle
whose start-edge and end-edge are parallel to and coincident with the start-edge
and end-edge of the nominal-requested-line-rectangle, and whose
extent in the block-progression-direction is the minimum required to enclose both the
nominal-requested-line-rectangle and the allocation-rectangles of all the
inline-areas stacked within the line-area; this may vary depending on the
descendants of the line-area.</p>

<figure>
<graphic source="Image10.gif" xml:attributes="href source" show="embed" actuate="auto" xmlns:xlink="http://www.w3.org/TR/WD-xlink"/>
<figcap><p>Nominal and Maximum Line Rectangles</p></figcap>
</figure>

<p>The <term>per-inline-height-rectangle</term> has the same length as the
nominal-requested-line-rectangle in the inline-progression-direction. For each
inline-area the <term>half-leading</term> is defined to be half the difference of its
line-height minus its block-progression-dimension. The
<term>expanded-rectangle</term> of an inline-area is the rectangle with start-edge
and end-edge coincident with those of its allocation-rectangle, and whose
before-edge and after-edge are outside those of its allocation-rectangle by a
distance equal to the half-leading. The per-inline-height-rectangle is then
defined to have the minimum block-progression-dimension required to enclose both
the nominal-requested-line-rectangle and the expanded-rectangles of all the
inline-areas stacked within the line-area; this may vary depending on the
descendants of the line-area.</p>
<note><p>
Using the nominal-requested-line-rectangle allows equal baseline-to-baseline
spacing. Using the maximum-line-rectangle allows constant space between line-areas.
Using the
per-inline-height-rectangle and zero space-before and space-after allows
CSS-style line box stacking.</p></note>
</div2>
<div2 id="area-inline"><head>Inline-areas</head>
<p>An inline-area has its own <term>line-height</term> trait, which may be
different from the line-height of its containing block-area. This may affect the
placement of its ancestor line-area when the line-stacking-strategy
is <code role="value">line-height</code>. An inline-area has a baseline table
for its nominal-font. It has
a <trait>dominant-baseline</trait> trait which determines how
its stacked inline-area descendants are to be aligned.</p>
<p>An inline-area may or may not have child areas, and if so it may or may not
be a reference-area. The dimensions of the content-rectangle for an inline-area
without children is computed as specified by the generating formatting object,
as are those of an inline-area with block-area children.</p>
<p>An inline-area with inline-area children has a content-rectangle which is
the minimum rectangle (with sides parallel to those of the content-rectangle
of its parent area) which includes the allocation-rectangles of all of its
children, and which extends from its position-point by at
least the
after-baseline-height in the block-progression-direction, and in the opposite
direction by at least the before-baseline-height from its position-point (these
latter quantities derived from the nominal-font of the area, as defined in
section <specref ref="area-font"/>).</p>
<p>Examples of inline-areas with children might include portions of inline
mathematical expressions or areas arising from mixed writing systems
(left-to-right within right-to-left, for example).</p>
</div2>
<div2 id="area-stackinline"><head>Stacked Inline-areas</head>
<p>Inline-area children of an area are typically stacked in the
inline-progression-direction
within their parent area, and this is the default method of
positioning inline-areas.</p>
<p>Inline-areas are stacked relative to a <term>baseline</term>, defined as
follows:</p>
<p>1. If <var>P</var> is a line-area, the baseline of <var>P</var> is defined
to be the line through the baseline-start-point which is parallel to the
inline-progression-direction;</p>
<p>2. If <var>P</var> is an inline-area, the baseline of <var>P</var> is defined
to be the line through the position-point of <var>P</var> which is parallel to
the inline-progression-direction.</p>
<p>For a parent area <var>P</var> whose children are inline-areas, <var>P</var>
is defined to be <term>properly stacked</term> if all of the following conditions
hold:</p>
<olist>
<item><p>For each inline-area descendant <var>I</var> of <var>P</var>, the
start-edge, end-edge, before-edge and after-edge of the allocation-rectangle
of <var>I</var> are parallel to corresponding edges of the content-rectangle
of the nearest ancestor reference-area of <var>I</var>.</p></item>
<item><p>For each pair of normal areas <var>I</var> and <var>I</var>'
in the subtree below <var>P</var>, if <var>I</var> and <var>I</var>' have
an inline-stacking constraint <var>S</var>, then the distance between the
adjacent edges of <var>I</var> and <var>I</var>' is consistent with the
constraint imposed by the resolved values of the space-specifiers in
<var>S</var>.</p></item>
<item><p>For any inline-area descendant <var>I</var> of <var>P</var>, the
distance in the shift-direction from the baseline of <var>P</var> to the
position-point of <var>I</var> equals the distance between the dominant-baseline
of <var>P</var> and the preferred baseline of <var>I</var> (as determined
by the dominant-baseline table of <var>P</var>), plus the
sum of the
baseline-shifts for <var>I</var> and all of its ancestors which are
descendants of <var>P</var>. This alignment is done with respect to the
line-area's dominant-baseline, and not with respect to the
baseline of any
intermediate area.</p><p> The first summand is computed to compensate for
mixed writing systems with different nominal glyph baselines, and the other
summands involve deliberate baseline shifts for things like superscripts
and subscripts.</p></item>
</olist>
</div2>
<div2 id="area-glyph"><head>Glyph-areas</head>
<p>The most common inline-area is a glyph-area, which contains the
representation for a character in a particular font.</p>
<p>A glyph-area has an associated <term>nominal-font</term>, determined by
the area's typographic traits, which apply to its character data, and
a <term>glyph-orientation</term> determined by its writing-mode and
reference-orientation, which determine the orientation of the glyph
when it is rendered.</p>
<p>The position-point and preferred baseline of a glyph-area are assigned
according to the writing-system in use (e.g., the glyph baseline
in Western languages), and are used to control placement of inline-areas
descendants of a line-area. The formatter may generate inline-areas with
different inline-progression-directions from their parent to accommodate
correct inline-area stacking in the case of mixed writing systems.</p>
<p>A glyph-area has no children. Its block-progression-dimension and
baseline table are the same for all glyphs in a font.</p>
</div2>

<div2 id="area-order"><head>Ordering Constraints</head>

<div3 id="area-genorder"><head>General Ordering Constraints</head>

<p>A subset <var>S</var> of the areas returned to a formatting object is
called <term>properly ordered</term> if the areas in that
subset have the
same order as their generating formatting objects.  Specifically, if <var>A</var><sub>1</sub>
and <var>A</var><sub>2</sub> are areas in <var>S</var>, returned by child
formatting objects <var>F</var><sub>1</sub> and <var>F</var><sub>2</sub>
where <var>F</var><sub>1</sub> precedes <var>F</var><sub>2</sub>,
then <var>A</var><sub>1</sub> must precede <var>A</var><sub>2</sub> in the
pre-order traversal order of the area tree. If <var>F</var><sub>1</sub>
equals <var>F</var><sub>2</sub> and <var>A</var><sub>1</sub> is
returned prior to <var>A</var><sub>2</sub>, then <var>A</var><sub>1</sub>
must precede <var>A</var><sub>2</sub> in the pre-order-traversal
of the area tree.
</p>
<p>For each formatting object <var>F</var> and each area-class <var>C</var>,
the subset consisting of the areas returned to <var>F</var> with area-class
<var>C</var> must be properly ordered, except where
otherwise specified.
</p>
</div3>
<div3 id="area-linebuild"><head>Line-building</head>
<p>This section describes the ordering constraints that apply to formatting
an fo:block or similar block-level object.</p>
<p>A block-level formatting object <var>F</var> which
constructs lines does so by
constructing block-areas which it returns to its parent
formatting object, and placing normal areas returned to
<var>F</var> by its child
formatting objects as children of those block-areas or of
line-areas
which it constructs as children of those block-areas.</p>
<p>For each such formatting object <var>F</var>, it must be
possible to form an
ordered partition <var>P</var> consisting of ordered subsets <var>S</var><sub>1</sub>,
<var>S</var><sub>2</sub>, ..., <var>S</var><sub><var>n</var></sub> of
the normal areas returned by the child formatting objects,
such that the following are all satisfied:</p>
<olist>
<item><p>Each subset consists of a sequence of inline-areas, or of a single
block-area.</p>
</item>
<item><p>The ordering of the partition follows the ordering of the
formatting object tree. Specifically, if <var>A</var> is in
<var>S</var><sub><var>i</var></sub>
and <var>B</var> is in <var>S</var><sub><var>j</var></sub> with
<var>i</var> &lt; <var>j</var>, or if <var>A</var> and <var>B</var> are both in the same subset
<var>S</var><sub><var>i</var></sub> with <var>A</var> before <var>B</var> in the
subset order, then either <var>A</var> is returned by a preceding sibling
formatting object of <var>B</var>, or <var>A</var> and
<var>B</var> are returned by the same
formatting object with <var>A</var> being returned before
<var>B</var>.</p>
</item>
<item><p>The partitioning occurs at legal line-breaks. Specifically, if <var>A</var> is
the last area of <var>S</var><sub><var>i</var></sub> and <var>B</var> is the first area of
<var>S</var><sub><var>i</var>+1</sub>, then the rules of
the language and script in effect must permit a line-break
between <var>A</var> and
<var>B</var>, within the context of all areas in <var>S</var><sub><var>i</var></sub>
and <var>S</var><sub><var>i</var>+1</sub>.</p>
</item>
<item><p>The partition follows the ordering of the area
tree, except for
certain glyph substitutions and deletions.  Specifically, if <var>B</var><sub>1</sub>,
<var>B</var><sub>2</sub>, ..., <var>B</var><sub><var>p</var></sub> are the normal
child areas of the area
or areas returned by <var>F</var>, (ordered in the pre-order traversal order of the
area tree) then there is a one-to-one correspondence between
these child areas
and the partition subsets (i.e., <var>n</var> = <var>p</var>), and for each <var>i</var>,</p>
<ulist>
<item><p>if <var>S</var><sub><var>i</var></sub> consists of a single block-area then
<var>B</var><sub><var>i</var></sub> is that block-area, and</p></item>
<item><p>if <var>S</var><sub><var>i</var></sub> consists of inline-areas then
<var>B</var><sub><var>i</var></sub> is a line-area whose child areas are the
same as the inline-areas in <var>S</var><sub><var>i</var></sub>, and in the same order,
except that where the rules of the language and script in effect call
for glyph-areas to be substituted, inserted, or deleted, then the
substituted or inserted glyph-areas appear in the area tree in the
corresponding place, and the deleted glyph-areas do not appear in the
area tree. Deletions occur when a glyph-area which is
first or last within a subset, has a
<trait>suppress-at-line-break</trait> value of <code role="value">suppress</code>.
Insertions and substitutions may
occur because of addition of hyphens or spelling changes due to
hyphenation, or glyph image construction from syllabification, or
ligature formation.</p></item>
</ulist>
</item>
</olist>
<p>Substitutions that replace a sequence of glyph-areas with a single
glyph-area should only occur when the margin, border, and padding in the
inline-progression-direction (start- and end-), baseline-shift, and
letter-spacing values are zero, treat-as-word-space is
<code role="value">false</code>, and the
values of all other relevant traits match (i.e.,
alignment-adjust, baseline-identifier, color
trait, background traits, dominant-baseline, font traits,
font-height-override-after,
font-height-override-before, glyph-orientation-horizontal,
glyph-orientation-vertical, line-height, line-height-shift-adjustment,
text-decoration, text-shadow).</p>
<note><p>Line-areas do not receive the background traits or text-decoration
of their generating formatting object, or any other trait that requires
generation of a mark during rendering.</p></note>
</div3>


<div3 id="area-inlinebuild"><head>Inline-building</head>
<p>This section describes the ordering constraints that apply to formatting
an fo:inline or similar inline-level object.</p>
<p>An inline-level formatting object <var>F</var> which
constructs one or more inline-areas does so by
placing normal inline-areas returned to <var>F</var> by its child
formatting objects as children of inline-areas which it
generates.</p>
<p>For each such formatting object <var>F</var>, it must be
possible to form an
ordered partition <var>P</var> consisting of ordered subsets <var>S</var><sub>1</sub>,
<var>S</var><sub>2</sub>, ..., <var>S</var><sub><var>n</var></sub> of
the normal inline-areas returned by the child formatting
objects, such that the following are all satisfied:</p>
<olist>
<item><p>Each subset consists of a sequence of inline-areas</p></item>
<item><p>The ordering of the partition follows the ordering of the
formatting object tree, as defined above.</p></item>
<item><p>The partitioning occurs at legal line-breaks, as defined above.</p></item>
<item><p>The partition follows the ordering of the area
tree, except for
certain glyph substitutions and deletions, as defined above
(except that the case where <var>S</var><sub><var>i</var></sub> is a block-area
does not arise).</p></item>
</olist>
</div3>
</div2>

<div2 id="keepbreak"><head>Keeps and Breaks</head>
<p>Keep and break conditions apply to a class of areas, which are typically
page-reference-areas,
column-areas, and line-areas.  The appropriate class for a given condition is referred
to as a <term>context</term> and an area in this class is a <term>context-area</term>.

As defined in Section <specref ref="pag-intro"/>, <term>page-reference-areas</term> are
areas generated by an fo:page-sequence using the
specifications in a fo:page-master, and
<term>column-areas</term>
are reference-areas generated from a region-master.</p>
<p>A keep or break condition is an open statement about a formatting object and the
tree relationships of the areas it generates with the relevant context-areas. These
tree relationships are defined mainly in terms of <term>leading</term> or <term>trailing</term>
areas.  If <var>A</var> is a descendant of <var>P</var>, then <var>A</var> is defined to
be <term>leading</term> in <var>P</var> if <var>A</var> has no preceding sibling which
is a normal area, nor does any of its ancestor areas up to but not including
<var>P</var>.  Similarly, <var>A</var> is defined to
be <term>trailing</term> in <var>P</var> if <var>A</var> has no following sibling which
is a normal area, nor does any of its ancestor areas up to but not including
<var>P</var>. For any given formatting object, the <term>next</term> formatting object
in the flow is the first formatting object following (in the pre-order traversal order)
which generates and returns normal areas.</p>
<p>Break conditions are either break-before or break-after conditions.  A break-before
condition is <term>satisfied</term> if the first area generated and returned
by the formatting object is
leading within a context-area. A break-after condition
depends on the next formatting object in
the flow; it is satisfied if either there is no such next formatting object, or if the
first normal area generated and returned by that formatting object is leading in a context-area.</p>
<p>Break conditions are imposed by the <trait>break-before</trait> and
<trait>break-after</trait> properties. A
refined value of <code role="value">page</code> for these traits imposes a
break condition with a context
consisting of the page-reference-areas; a value of <code role="value">even-page</code>
or <code role="value">odd-page</code> imposes a
break condition with a context of even-numbered page-reference-areas
or odd-numbered
page-reference-areas, respectively; a value of <code role="value">column</code> imposes a
break condition with a
context of column-areas. A value of <code role="value">auto</code> in a
break-before or break-after
trait imposes no break condition.</p>
<p>Keep conditions are either keep-with-previous, keep-with-next, or keep-together
conditions.  A keep-with-previous condition on an object is satisfied if the first
area generated and returned by the formatting object is not leading within a
context-area, or if
there are no preceding areas in a post-order traversal of the area tree.  A
keep-with-next condition is satisfied if the last area generated and returned by the
formatting object is not trailing within a context-area, or
if there are
no following areas in a pre-order traversal of the area tree.  A keep-together
condition is satisfied if all areas generated and returned by the formatting object are
descendants of a single context-area.</p>
<p>Keep conditions are imposed by the "within-page", "within-column", and "within-line" components
of the <trait>keep-with-previous</trait>, <trait>keep-with-next</trait>, and
<trait>keep-within</trait> properties.
The refined value of each component specifies the <term>strength</term> of the keep condition
imposed, with higher numbers being stronger than lower numbers and the value
<code role="value">always</code> being stronger than all numeric values.
A component with value <code role="value">auto</code>
does not impose a keep condition.  A "within-page" component imposes a keep-condition
with context consisting of the page-reference-areas; "within-column", with context consisting of
the column-areas; and "within-line" with context consisting of the line-areas.</p>
<p>The area tree is constrained to satisfy all break conditions imposed.
Each keep condition must also be satisfied, except when this would cause a
break condition or a stronger keep condition to fail to be satisfied. If not
all of a set of keep conditions of equal strength can be satisfied, then some
maximal satisfiable subset of conditions of that strength
must be satisfied (together with all break conditions
and maximal subsets of stronger keep conditions, if any).</p>
</div2>

<div2 id="rendmodel"><head>Rendering Model</head>
<p>
This section makes explicit the relationship between the area tree
and visually rendered output.
</p>
<p>
Areas generate three types of marks: (1) the area
background, if any, (2) the marks
intrinsic to the area (a glyph, image, or decoration) if any, and (3) the
area border, if any.
</p>
<p>
An area tree is rendered by causing marks to appear on an output medium in
accordance with the areas in the area tree.  This section describes the
geometric location of such marks, and how conflicts between marks are to
be resolved.
</p>
<div3 id="rend-geo"><head>Geometry</head>
<p>
Each area is rendered in a particular location. Formatting object semantics
describe the location of instrinsic marks relative to the object's location,
i.e., the left, right, top and bottom edges of its content-rectangle. This
section describes how the area's location is determined,
which determines the location of its intrinsic marks.
</p>
<p>
For each page, the page-viewport-area corresponds isometrically to the
output medium.
</p>
<p>
The page-reference-area is offset from the page-viewport-area as described
below in section <specref ref="rend-view"/>.
</p>
<p>
All areas in the tree with an area-class of <code role="value">xsl-fixed</code>
are positioned such
that the left-, right-, top-, and bottom-edges of its
content-rectangle are
offset inward from the content-rectangle of its ancestor page-viewport-area
by distances specified by the <trait>left-position</trait>,
<trait>right-position</trait>, <trait>top-position</trait>,
and <trait>bottom-position</trait> traits, respectively.
</p>
<p>
Any area in the tree which is the child of a viewport-area is rendered
as described in section <specref ref="rend-view"/>.
</p>
<p>
All other areas in the tree are positioned such that the
left-, right-, top-,
and bottom-edges of its content-rectangle are offset inward
from the
content-rectangle of its nearest ancestor reference-area by distances
specified by the <trait>left-position</trait>,
<trait>right-position</trait>, <trait>top-position</trait>,
and
<trait>bottom-position</trait> traits, respectively.  These are shifted left
and down by the values of the <trait>top-offset</trait>
and <trait>left-offset</trait> traits, respectively, if the area
has a <trait>relative-position</trait> of <code role="value">relative</code>.
</p>
</div3>
<div3 id="rend-view"><head>Viewport Geometry</head>
<p>
A reference-area which is the child of a viewport-area is positioned
such that
the start-edge and end-edge of its content-rectangle are
coincident with the
start-edge and end-edge of the content-rectangle of its parent
viewport-area,
and the before-edge of its content-rectangle is offset from the
before-edge of
the content-rectangle of its parent viewport-area by a
<term>scroll-amount</term>.
</p>
<p>
If the block-progression-dimension of the reference-area is larger
than that
of the viewport-area and the <trait>overflow</trait> trait
for the reference-area is <code role="value">scroll</code>,
then the scroll-amount is determined by a scrolling mechanism, if any,
provided by the user agent. Otherwise, the scroll-amount is zero.
</p>
</div3>
<div3 id="rend-vis"><head>Visibility</head>
<p>
The visibility of marks depends upon the location of the marks,
the <trait>visibility</trait> of the area, and the <trait>overflow</trait> of any ancestor
viewport-areas.
</p>
<p>
If an area has visibility <code role="value">hidden</code> it generates no marks.
</p>
<p>
If an area has an <trait>overflow</trait> of <code role="value">hidden</code>,
or when the environment is non-dynamic and the <trait>overflow</trait> is
<code role="value">scroll</code> then the area determines
a <term>clipping rectangle</term>, which is defined to be the
rectangle determined by the value of the <trait>clip</trait> trait of the area, and
for any mark
generated by one of its descendant areas, portions of the mark
lying outside
the clipping rectangle do not appear.</p>
</div3>
<div3 id="rend-border"><head>Border, Padding, and Background</head>
<p>
The border- and padding-rectangles are determined relative to the
content-rectangle by the values of the common padding and border width
traits (border-before-width, etc.).
</p>
<p>
For any area which is not a child of a viewport-area, the border is
rendered between the border-rectangle and the padding-rectangle in
accordance with the common border color and style traits. For a child of
a viewport-area, the border is not rendered.
</p>
<p>For an area which is not part of a viewport/reference pair, the
background is rendered. For an area that is either a viewport-area or a
reference-area in a viewport/reference pair, if the refined value of
<trait>background-attachment</trait> is <code role="value">scroll</code>
and the block-progression-dimension of the reference-area is larger than
that of the viewport-area, then the background is rendered on the
reference-area and not the viewport-area, and otherwise it is rendered
on the viewport-area and not the reference-area.
</p>
<p>
The background, if any, is rendered in the
padding-rectangle, in accordance
with the <trait>background-image</trait>,
<trait>background-color</trait>,
<trait>background-repeat</trait>,
<trait>background-position-vertical</trait>, and
<trait>background-position-horizontal</trait> traits.
</p>
</div3>
<div3 id="rend-intrinsic"><head>Intrinsic Marks</head>
<p>
For each class of formatting objects, the marks intrinsic to its
generated areas are specified in the formatting object description.
For example, an fo:character object generates a glyph-area, and this
is rendered by drawing a glyph within that area's
content-rectangle in accordance with the area's font traits and <trait>glyph-orientation</trait>
and <trait>blink</trait> traits.
</p>
<p>
In addition, other traits (for example the various score and score-color traits) specify
other intrinsic
marks.  In the case of score traits (<trait>underline-score</trait>,
<trait>overline-score</trait> and <trait>through-score</trait>), the score thickness and position
are specified by the nominal-font in effect; where the font fails to
specify these quantities, they are implementation-dependent.

</p>
</div3>
<div3 id="rend-layer"><head>Layering and Conflict of Marks</head>
<p>
Marks are layered as described below, which defines a partial
ordering of which marks are <term>beneath</term> which other marks.
</p>
<p>
Two marks are defined to <term>conflict</term> if they apply to
the same point
in the output medium. When two marks conflict, the one which is
beneath the other does not affect points in the output medium where
they both apply.
</p>
<p>
Marks generated by the same area are layered as follows:  the area
background is beneath the area's intrinsic marks, and the intrinsic
marks are beneath the border.  Layering among the area's intrinsic
marks is defined by the semantics of the area's generating formatting
object and its properties.  For example, a glyph-area's glyph drawing
comes beneath the marks generated for text-decoration.
</p>
<p>
If <var>A</var> and <var>B</var> are areas, and the z-index
of <var>A</var> is less than the z-index
of <var>B</var>, then all marks generated by <var>A</var>
are beneath all marks generated by <var>B</var>.
</p>
<p>
If <var>A</var> and <var>B</var> are areas with the same
z-index, the backgrounds of <var>A</var> and <var>B</var>
come beneath all other marks generated by <var>A</var> and
<var>B</var>. Further, if <var>A</var> is an
ancestor of <var>B</var> (still with the same z-index), then
the background of <var>A</var>
is beneath all the areas of <var>B</var>, and all the areas
of <var>B</var> are beneath the intrinsic areas (and border)
of <var>A</var>.
</p>
<p>
If <var>A</var> and <var>B</var> have the same z-index and
neither is an ancestor of the other,
then it is an error if either their backgrounds conflict or if a
non-background mark of <var>A</var> conflicts with a
non-background mark of <var>B</var>.
An implementation may recover by proceeding as if the marks from the
first area in the pre-order traversal order are beneath those of the
other area.
</p>
</div3>
</div2>
<div2 id="area-tree-sample"><head>Sample Area Tree</head>
<graphic source="page-area-tree.gif" xml:attributes="href source" show="embed" actuate="auto" xmlns:xlink="http://www.w3.org/TR/WD-xlink"/>
</div2>
<div2 id="area-traitlist"><head>List of Traits on Areas</head>
<ulist>
<item><p>block-progression-direction</p></item>
<item><p>inline-progression-direction</p></item>
<item><p>shift-direction</p></item>
<item><p>glyph-orientation</p></item>
<item><p>is-reference-area</p></item>
<item><p>is-viewport-area</p></item>
<item><p>left-position</p></item>
<item><p>right-position</p></item>
<item><p>top-position</p></item>
<item><p>bottom-position</p></item>
<item><p>left-offset</p></item>
<item><p>top-offset</p></item>
<item><p>is-first</p></item>
<item><p>is-last</p></item>
<item><p>position-point</p></item>
<item><p>area-class</p></item>
<item><p>start-intrusion-adjustment</p></item>
<item><p>end-intrusion-adjustment</p></item>
<item><p>generated-by</p></item>
<item><p>returned-by</p></item>
<item><p>page-number</p></item>
<item><p>blink</p></item>
<item><p>underline-score</p></item>
<item><p>overline-score</p></item>
<item><p>through-score</p></item>
<item><p>underline-score-color</p></item>
<item><p>overline-score-color</p></item>
<item><p>through-score-color</p></item>
</ulist>
</div2>
</div1>


<div1 id="refinement"><head>Property Refinement / Resolution</head>


<p>During refinement the set of <term>properties</term> that apply to a formatting
object is transformed into a set of <term>traits</term> that
define constraints on the result of formatting. For many traits there
is a one-to-one correspondence with a property; for other traits the
transformation is more complex. Details on the transformation are
described below.
</p>
<p>The first step in refinement of a particular formatting object
is to obtain the effective value of each property that applies to the
object. Any shorthand property specified on the formatting object is
expanded into the individual properties. This is further described in
<specref ref="shortexpan"/>. For any property that has not been specified
on the object the inherited (see <specref ref="inheritance"/>)
or initial value, as applicable, is used as the effective value.
The second step is to transform this property set into traits.
</p>
<note><p>Although the refinement process is described in a series of
steps, this is solely for the convenience of exposition
and does not imply they must be implemented as separate
steps in any conforming implementation. A conforming implementation
must only achieve the same effect.</p>
</note>
<div2 id="speccomact">
<head>Specified, Computed, and Actual Values, and Inheritance</head>
<p>For every property that is applicable to a given
formatting object, it is necessary to determine
the value of the property.
Three variants of the property value are
distinguished: the specified value, the computed value, and
the actual value. The "specified value" is one that is
placed on the formatting object during the tree-construction process.
A specified value may not be in a
form that is directly usable; for example, it may be a
percentage or other expression
that must be converted into an absolute value.
A value resulting from such a conversion is called the
"computed value".  Finally, the computed value may not be
realizable on the output medium and may need to be adjusted
prior to use in rendering. For example, a line width may be
adjusted to become an integral number of output
medium pixels. This adjusted value is the "actual value."</p>
<div3><head>Specified Values</head>
<p>The specified value of a property is
determined using the following mechanisms
(in order of precedence):</p>
<olist><item><p>
If the tree-construction process placed the property
on the formatting object, use the value of that property
as the specified value.  This is called "explicit
specification".</p></item>
<item><p>
Otherwise, if the property is inheritable, use the value of that
property from the parent formatting object, generally the
computed value (see below).</p></item>
<item><p>
Otherwise use the property's initial value, if it has one.
The initial value of each property is indicated in the
property's definition. If there is no initial value, that
property is not specified on the formatting object.
In general, this is an error.
</p></item></olist>
<p>Since it has no parent, the root of the result tree
cannot use values from its parent formatting
object; in this case, the initial value is used if necessary.</p>
</div3>
<div3><head>Computed Values</head>
<p>Specified values may be absolute (i.e., they are not
specified relative to another value, as in "red" or "2mm")
or relative (i.e., they are specified relative to another value,
as in "auto", "2em", and "12%"), or they may be expressions.
For most absolute values, no
computation is needed to find the computed value. Relative values,
on the other hand, must be transformed into computed values: percentages
must be multiplied by a reference value (each property defines which value
that is), values with a relative unit (em)
must be made absolute by multiplying with the appropriate font size,
"auto" values must be computed by the formulas given with
each property, certain property
values ("smaller", "bolder") must be replaced
according to their definitions.
The computed value of any property that controls a border width
where the style of
the border is "none" is forced to be "0pt".</p>
<p>
Some properties have more than one way in which the property value can be specified.
The simplest example of such properties are those which can be specified
either in terms of a direction relative to the writing-mode (e.g., padding-before)
or a direction in terms of the absolute geometric orientation of the viewport
(e.g., padding-top). These two properties are called the
relative property and the absolute property, respectively.
Collectively, they are called "corresponding properties".</p>
<p>Specifying a value for one property determines both a
computed value for the specified property and a computed value
for the corresponding property.
Which relative property corresponds to which absolute
property depends on the writing-mode. For example, if
the "writing-mode" at the top level of a document is
"lr-tb",
then "padding-start" corresponds to "padding-left", but if
the "writing-mode" is "rl-tb", then "padding-start"
corresponds to "padding-right".
The exact specification of how to compute the values of
corresponding properties is given in <specref ref="compcorr"/>.</p>
<p>In most cases, elements inherit computed values. However,
there are some properties whose specified value may be
inherited (e.g., the value for the "line-height"
property).
In the cases where child elements do not inherit the computed value,
this is described in the property definition.</p>
</div3>
<div3><head>Actual Values</head>
<p>A computed value is in principle ready to be
used, but a user agent may not be able to make
use of the value in a given environment. For
example, a user agent may only be able to render
borders with integer pixel widths and may, therefore,
have to adjust the computed width to an integral number
of media pixels. The actual
value is the computed value after any such adjustments have been applied.</p>
</div3>
<div3 id="inheritance"><head>Inheritance</head>
<p>Some of the properties applicable to formatting objects are "inheritable."
Such properties are so identified in the property description.
The inheritable properties can be placed on any formatting
object.  The inheritable properties are propagated down the
formatting object tree from a parent to each child.  (These properties
are given their initial value at the root of the result tree.)
For a given inheritable property, if that property is present on a
child, then that value of the property is used for that child
(and its descendants until explicitly re-set in a lower descendant);
otherwise, the specified value of that property on the child is the
computed value of that property on the parent formatting
object. Hence there is always a specified value
defined for every inheritable property for every
formatting object.</p>
</div3>
</div2>

<div2 id="shortexpan"><head>Shorthand Expansion</head>
<p>In XSL there are two kinds of shorthand properties; those originating
from CSS, such as "border", and those that arise from breaking apart
and/or combining CSS properties, such as "page-break-inside". In XSL
both types of shorthands are handled in the same way.</p>
<note><p>Shorthands are only included in the highest XSL conformance
level; "complete".</p>
<p>The conformance level for each property is shown in
<specref ref="prtab2"/>.</p>
</note>
<p>Shorthand properties do not inherit from
the shorthand on the parent. Instead the individual properties that
the shorthand expands into may inherit.</p>
<p>Some CSS shorthands are interrelated; their expansion has one
or more individual properties in common.
CSS indicates that the user must specify the order of processing
for combinations of multiple interrelated shorthands and individual
interrelated properties. In XML, attributes are defined as unordered.
To resolve this issue, XSL defines a precedence order
when multiple interrelated shorthand properties or a shorthand property
and an interrelated individual property are specified:</p>
<p>They are processed in increasing precision (i.e., "border" is less precise
than "border-top", which is less precise than "border-top-color").
The individual properties are always more precise than any shorthand.
For the remaining ambiguous case, XSL defines the ordering to
be:</p>
<olist>
<item><p>"border-style", "border-color", and "border-width"
is less precise than</p></item>
<item><p>"border-top", "border-bottom", "border-right",
and "border-left".</p></item>
</olist>
<p>Processing is conceptually in the following steps:</p>
<olist>
<item><p>Set the effective value of
all properties to their initial values.</p></item>
<item><p>Process all shorthands in increasing precision.</p>
<p>If the shorthand is set to "inherit": set the effective
value of each property that can be set by the shorthand to
the computed value of the corresponding property in the parent.</p>
<p>If the value of the shorthand is not "inherit": determine which
individual properties are to be set, and replace the
initial-value with the computed value derived from the specified
value.</p></item>
<item><p>Process all specified individual properties.</p>
</item>
<item><p>Carry out any inheritance for properties that were
not given a value other than by the first step.</p>
</item>
</olist>
<note><p>For example,
if both the "background"
and the "background-color" properties are specified on a given
formatting object:
process the "background" shorthand, then process the
"background-color" property.</p></note>
</div2>

<div2 id="compcorr"><head>Computing the Values of Corresponding Properties</head>
<p>Where there are corresponding properties, such as "padding-left"
and "padding-start", a computed value is determined for all the
corresponding properties. How the computed values are determined
for a given formatting object is dependent on which of
the corresponding properties are specified on the object. See description
below.</p>
<p>The correspondance mapping from absolute to relative property
is as follows:
</p>
<p>If the "writing-mode" specifies a block-progression-direction of
"top-to-bottom": "top" maps to "before", and "bottom" maps to "after".</p>
<p>If the "writing-mode" specifies a block-progression-direction of
"bottom-to-top": "top" maps to "after", and "bottom" maps to "before".</p>
<p>If the "writing-mode" specifies a block-progression-direction of
"left-to-right": "left" maps to "before", and "right" maps to "after".</p>
<p>If the "writing-mode" specifies a block-progression-direction of
"right-to-left": "left" maps to "after", and "right" maps to "before".</p>
<p>If the "writing-mode" specifies an inline-progression-direction of
"left-to-right": "left" maps to "start", and "right" maps to "end".</p>
<p>If the "writing-mode" specifies an inline-progression-direction of
"right-to-left": "left" maps to "end", and "right" maps to "start".</p>
<p>If the "writing-mode" specifies an inline-progression-direction of
"top-to-bottom": "top" maps to "start", and "bottom" maps to "end".</p>
<p>If the "writing-mode" specifies an inline-progression-direction of
"bottom-to-top": "top" maps to "end", and "bottom" maps to "start".</p>
<p>If the "writing-mode" specifies an inline-progression-direction of
"left-to-right" for odd-numbered lines, and "right-to-left" for
even-numbered lined: "left" maps to "start", and "right" maps to "end".</p>
<note><p>"reference-orientation" is a rotation and does not influence
the correspondance mapping.
</p>
</note>
<div3 id="refine-border-padding"><head>Border and Padding Properties</head>
<p>The simplest class of corresponding properties are
those for which there are only two variants in the
correspondance, an absolute property and a relative
property, and the property names differ only in the
choice of absolute or
relative designation; for example, "border-left-color" and
"border-start-color".</p>
<p>For this class, the computed values of the corresponding
properties are determined as follows. If the corresponding
absolute variant of the property is specified on the formatting
object, its computed value is used to set the computed value of the
corresponding relative property.  If the corresponding absolute property
is not explicitly specified, then the computed
value of the absolute property is set to the computed value of the
corresponding relative property.</p>
<p>Note that if both the absolute and the relative
properties are not
explicitly specified, then the rules for determining the specified
value will use either inheritance if that is defined for the property
or the initial value. The initial value must be the same for all possible
corresponding properties. If both an absolute and a corresponding relative
property are explicitly specified, then the above rule gives precedence to the
absolute property, and the specified value of the
corresponding relative property
is ignored in determining the computed value of the corresponding properties.</p>
<p>The (corresponding) properties that use the above rule to
determine their computed value are:</p>
<ulist>
<item><p>border-after-color</p></item>
<item><p>border-before-color</p></item>
<item><p>border-end-color</p></item>
<item><p>border-start-color</p></item>
<item><p>border-after-style</p></item>
<item><p>border-before-style</p></item>
<item><p>border-end-style</p></item>
<item><p>border-start-style</p></item>
<item><p>border-after-width</p></item>
<item><p>border-before-width</p></item>
<item><p>border-end-width </p></item>
<item><p>border-start-width</p></item>
<item><p>padding-after</p></item>
<item><p>padding-before</p></item>
<item><p>padding-end</p></item>
<item><p>padding-start </p></item>
</ulist>
</div3>
<div3><head>Margin, Space, and Indent Properties</head>
<p>The "space-before", and "space-after" properties (block-level
formatting objects), "space-start", and "space-end" properties
(inline-level formatting objects) are handled in the same way as the
properties immediately above, but the corresponding
absolute properties are in the set: "margin-top",
"margin-bottom", "margin-left", and "margin-right".</p>
<p>There are two more properties, "end-indent" and
"start-indent" (block-level formatting objects),
for which the computed value may be
determined by the computed value of the
absolute margin properties. For these traits,
the calculation of the value of the trait when the
corresponding absolute property is present depends on
three computed values: the computed value of the corresponding
absolute property, the computed value of the corresponding
"padding"
property, and the computed value of the corresponding
"border-width" property.</p>
<p>Here the term "corresponding" has been broadened to mean
that if
"margin-left" is the corresponding absolute property
to "start-indent", then
"padding-left" (and "padding-start")
and "border-left-width" (and "border-start-width") are the
"corresponding" "padding" and "border-width" properties.</p>
<p>The formulae for calculating the computed value of the
"start-indent", and "end-indent" properties are as follows (where
"margin-corresponding" is a variable for the
corresponding absolute "margin" property):</p>
<p><code>
end-indent = margin-corresponding + padding-end + border-end-width</code></p>
<p><code>start-indent = margin-corresponding + padding-start + border-start-width</code></p>
<p>If an absolute "margin" property is not explicitly
specified,
these equations determine a computed value for the corresponding
"margin" property given values for the three traits
<emph>corresponding</emph>-indent,
padding-<emph>corresponding</emph> and
border-<emph>corresponding</emph> width.</p>
</div3>
<div3><head>Height, and Width Properties</head>
<p>Based on the writing-mode in effect for the formatting object,
either the "height", "min-height", and "max-height" properties, or
the "width", "min-width", and "max-width" properties are converted
to the corresponding block-progression-dimension, or
inline-progression-dimension.</p>
<p>The "height" properties are absolute and indicate the dimension
from "top" to "bottom"; the width properties the dimension from
"left" to "right".</p>
<p>If the "writing-mode" specifies a block-progression-direction of
"top-to-bottom" or "bottom-to-top" the conversion is as follows:</p>
<ulist>
<item><p>If any of "height", "min-height", or "max-height" is specified:</p>
<ulist>
<item><p>If "height" is specified then first set:</p>
<p>block-progression-dimension.minimum=&lt;height&gt;</p>
<p>block-progression-dimension.optimum=&lt;height&gt;</p>
<p>block-progression-dimension.maximum=&lt;height&gt;</p>
</item>
<item><p>If "height" is not specified, then first set:</p>
<p>block-progression-dimension.minimum=auto</p>
<p>block-progression-dimension.optimum=auto</p>
<p>block-progression-dimension.maximum=auto</p>
</item>
<item><p>Then, if "min-height" is specified, reset:</p>
<p>block-progression-dimension.minimum=&lt;min-height&gt;</p>
</item>
<item><p>Then, if "max-height" is specified, reset:</p>
<p>block-progression-dimension.minimum=&lt;max-height&gt;</p>
</item>
<item><p>However, if "max-height" is specified
as "none", reset:</p>
<p>block-progression-dimension.minimum=auto</p>
</item>
</ulist>
</item>
<item><p>If any of "width", "min-width", or "min-width" is specified:</p>
<ulist>
<item><p>If "width" is specified then first set:</p>
<p>inline-progression-dimension.minimum=&lt;width&gt;</p>
<p>inline-progression-dimension.optimum=&lt;width&gt;</p>
<p>inline-progression-dimension.maximum=&lt;width&gt;</p>
</item>
<item><p>If "width" is not specified, then first set:</p>
<p>inline-progression-dimension.minimum=auto</p>
<p>inline-progression-dimension.optimum=auto</p>
<p>inline-progression-dimension.maximum=auto</p>
</item>
<item><p>Then, if "min-width" is specified, reset:</p>
<p>inline-progression-dimension.minimum=&lt;min-width&gt;</p>
</item>
<item><p>Then, if "max-width" is specified, reset:</p>
<p>inline-progression-dimension.minimum=&lt;max-width&gt;</p>
</item>
<item><p>However, if "max-width" is specified
as "none", reset:</p>
<p>inline-progression-dimension.minimum=auto</p>
</item>
</ulist>
</item>
</ulist>
<p>If the "writing-mode" specifies a block-progression-direction of
"left-to-right" or "right-to-left" the conversion is as follows:</p>
<ulist>
<item><p>If any of "height", "min-height", or "max-height" is specified:</p>
<ulist>
<item><p>If "height" is specified then first set:</p>
<p>inline-progression-dimension.minimum=&lt;height&gt;</p>
<p>inline-progression-dimension.optimum=&lt;height&gt;</p>
<p>inline-progression-dimension.maximum=&lt;height&gt;</p>
</item>
<item><p>If "height" is not specified, then first set:</p>
<p>inline-progression-dimension.minimum=auto</p>
<p>inline-progression-dimension.optimum=auto</p>
<p>inline-progression-dimension.maximum=auto</p>
</item>
<item><p>Then, if "min-height" is specified, reset:</p>
<p>inline-progression-dimension.minimum=&lt;min-height&gt;</p>
</item>
<item><p>Then, if "max-height" is specified, reset:</p>
<p>inline-progression-dimension.minimum=&lt;max-height&gt;</p>
</item>
<item><p>However, if "max-height" is specified
as "none", reset:</p>
<p>inline-progression-dimension.minimum=auto</p>
</item>
</ulist>
</item>
<item><p>If any of "width", "min-width", or "min-width" is specified:</p>
<ulist>
<item><p>If "width" is specified then first set:</p>
<p>block-progression-dimension.minimum=&lt;width&gt;</p>
<p>block-progression-dimension.optimum=&lt;width&gt;</p>
<p>block-progression-dimension.maximum=&lt;width&gt;</p>
</item>
<item><p>If "width" is not specified, then first set:</p>
<p>block-progression-dimension.minimum=auto</p>
<p>block-progression-dimension.optimum=auto</p>
<p>block-progression-dimension.maximum=auto</p>
</item>
<item><p>Then, if "min-width" is specified, reset:</p>
<p>block-progression-dimension.minimum=&lt;min-