<?xml version="1.0" encoding="utf-8"?>
<spec>
<header>
<title>Extensible Stylesheet Language (XSL)</title>
<version>Version 1.0</version>
<w3c-designation>xsl-20001018</w3c-designation>
<w3c-doctype>W3C Working Draft</w3c-doctype>
<pubdate><day>18</day><month>October</month><year>2000</year></pubdate>
<publoc>
<loc href="http://www.w3.org/TR/2000/WD-xsl-20001018/" show="replace" actuate="user" xmlns:xlink="http://www.w3.org/TR/WD-xlink">http://www.w3.org/TR/2000/WD-xsl-20001018/</loc>
<otherversions>
<loc href="http://www.w3.org/TR/2000/WD-xsl-20001018/xslspecRX.pdf" show="replace" actuate="user" xmlns:xlink="http://www.w3.org/TR/WD-xlink">PDF by RenderX</loc>,
<loc href="http://www.w3.org/TR/2000/WD-xsl-20001018/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-20001018/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-20001018/xs001018.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-20000327" show="replace" actuate="user" xmlns:xlink="http://www.w3.org/TR/WD-xlink">http://www.w3.org/TR/2000/WD-xsl-20000327</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>Pageflex</affiliation>
<email href="mailto:jcaruso@pageflexinc.com" show="new" actuate="user" xmlns:xlink="http://www.w3.org/TR/WD-xlink">jcaruso@pageflexinc.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>BroadVision</affiliation>
<email href="mailto:Jeremy.Richman@BroadVision.com" show="new" actuate="user" xmlns:xlink="http://www.w3.org/TR/WD-xlink">Jeremy.Richman@BroadVision.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.
This working draft incorporates the proposed resolution of the
issues raised during Last Call.
The Working Group intends to submit a revised version of
this specification for
publication as a Candidate Recommendation in the near future.
We are issuing this interim public draft as it sets out a
number of changes made in response to comments received on the
Last Call draft.
Items under consideration for change for Candidate Recommendation
include
the name of the font-height-override-before and
font-height-override-after properties.
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>;
<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.<spot id="aj000035_1"/></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>
<p><spot id="wai_1"/>In some implementations of XSL/XSLT,
the result of tree construction
can be output as an XML document. This would allow an XML document
which contains formatting objects and formatting properties to be
output. This capability is neither necessary for an XSL processor nor
is it encouraged. There are, however, cases where this is important,
such as a server preparing input for a known client; for example, the way
that a WAP
(<xspecref href="http://www.wapforum.org/faqs/index.htm" show="new" actuate="user" xmlns:xlink="http://www.w3.org/TR/WD-xlink">http://www.wapforum.org/faqs/index.htm</xspecref>)
server prepares specialized input for a WAP capable
hand held device. To preserve accessibility, designers of Web systems
should not develop architectures that require (or use) the
transmission of documents containing formatting objects and properties
unless either the transmitter knows that the client can accept
formatting objects and properties or the transmitted document contains
a reference to the source document(s) used in the construction of the
document with the formatting objects and properties.
</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.
<spot id="fo_12"/>Characters in text nodes which consist
solely of whitespace characters and
which are children of elements whose corresponding formatting objects do
not permit fo:character nodes as children are ignored.  Other characters
within elements whose corresponding formatting objects do not permit
fo:character nodes as children are errors.

</p>
<p><spot id="fo01jr_3c"/>The content of the fo:instream-foreign-object
is not objectified;
instead the object representing the fo:instream-foreign-object
element points to the appropriate node in the element and
attribute tree.
<spot id="wai_4f"/>Similarly any non-XSL namespace child element
of fo:declarations is not objectified; instead the object representing
the fo:declarations element points to the appropriate node in the
element and attribute tree.
</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.<spot id="aj000035_2"/>
</p>
<graphic source="trees4-5.gif" xml:attributes="href source" show="embed" actuate="auto" xmlns:xlink="http://www.w3.org/TR/WD-xlink"/>
<graphic source="process-sum.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 <spot id="c11i14_a"/>sidebars, and a Web
presentation using "frames". The distribution of content into the regions
is basically the same in both cases, and XSL handles both
cases in an analogous fashion.</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 <spot id="aj000035_3"/>"linefeed-treatment" property that controls
how line-feeds are processed, a "white-space-collapse" property that controls
how multiple consecutive spaces are collapsed,
and a "wrap-option" property
that controls whether lines are automatically wrapped when
they encounter a boundary, such as the edge of a column.
The effect of splitting a property into two or more
(sub-)properties is to make the equivalent existing CSS2
property a "shorthand" for the set of sub-properties it subsumes.
</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>
<spot id="c11i15"/>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 <spot id="c11i14_b"/>sidebars; 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 <spot id="c11i14_c"/>sidebars
on a page. These simple-page-masters can be used in page sequences
that specify in which order the various simple-page-masters shall be used.
The page sequence also specifies how styled content is to fill those pages.
This model allows one to specify a sequence of simple-page-masters
for a book chapter where the page instances are automatically
generated by the formatter or an explicit sequence of pages
such as used in a magazine layout. Styled content is assigned
to the various regions on a page by associating the name of the
region with names attached to styled content in the result tree.
</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 <spot id="i18n_2"/>some scripts, in particular in the Far East, that are
typically set with words proceeding from top-to-bottom and
lines proceeding either from right-to-left (most common) or
from left-to-right. Other directions are also
used. Properties expressed in terms of a fixed,
absolute frame of reference (using top, bottom, left, and right)
and which apply only to a notion of words proceeding from left to right
or right to left do not generalize well to
<spot id="i18n_4"/>text written in those 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. <spot id="c11i16"/>See <specref ref="writing-mode"/>
for the description of the "writing-mode" property.
Typically, the writing-mode value specifies two directions:<spot id="c11i17"/>
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.
<spot id="i18n_5"/>In addition, the inline-progression-direction
for a sequence of characters may be implicitly determined using
bidirectional character types for those characters from the
Unicode Character Database  <bibref ref="UNICODE-CD"/>
for those characters and the Unicode Bidi Algorithm <bibref ref="UNICODE-TR9"/>.
</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.
<spot id="link01_i3"/>In this context, "link" refers
to "hypertext link" as defined in
<xspecref href="http://www.w3.org/TR/html401/struct/links.html#h-12.1" show="new" actuate="user" xmlns:xlink="http://www.w3.org/TR/WD-xlink">http://www.w3.org/TR/html401/struct/links.html#h-12.1</xspecref>
as well as some of the aspects of "link" as defined in
<xspecref href="http://www.w3.org/TR/xlink/#intro" show="new" actuate="user" xmlns:xlink="http://www.w3.org/TR/WD-xlink">http://www.w3.org/TR/xlink/#intro</xspecref>,
where "link is a relationship between two or more resources or
portions of resources, made explicit by an XLink linking element".
Therefore,
XSL has a formatting object that expresses the dual semantics of
formatting the content of the link reference and the
semantics of following the link.</p>
<note><p><spot id="link01_i2"/>During the CR period
the XSL WG and Linking WG will jointly
develop additional examples and guidance on how to use these
formatting objects given XPointer and XLink XML source.</p>
</note>
<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 <spot id="c11i18"/>lowercase,
hyphens are used to separate words, dots are used to
separate names for the components of complex datatypes,
and abbreviations are used only if they already
appear in the syntax of a related language such as XML or
HTML.</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 <spot id="aj000035_4"/>elements.
<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. <specref ref="fo-section"/> and
<specref ref="pr-section"/><spot id="aj000029_19a"/>
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
<spot id="c11i1_a"/><specref ref="area_model"/> 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,<spot id="c11i20_a"/></p></item>
<item><p>converting relative numerics to absolute numerics,</p></item>
<item><p>constructing some composite properties from more than one attribute<spot id="c11i20_b"/></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
<spot id="c11i1_b"/><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;<spot id="c11i21"/> 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="RectsOnlyForModel.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 or derived from <spot id="aj000029_22a"/>a 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>
<note><p>NOTE: traits are also associated with FOs during the process of refinement.
Some traits are assigned during formatting, while others are already present after
refinement.</p></note>
<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 or a corresponding 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 of areas are: a paragraph rendered by using
an fo:block formatting object,
which generates block-areas,
and a character rendered by using an fo:character
formatting object,
which generates an inline-area (in fact, a glyph-area).</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 <trait>is-reference-area</trait> 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 <trait>is-viewport-area</trait> 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> are parallel to 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 <spot id="aj000029_23a"/>dimensions.</p>

<p>Other traits include:</p>
<ulist><item>
<p>the <trait>is-first</trait> and <trait>is-last</trait> traits, which are Boolean traits
indicating the order in which areas are generated and returned by a given
formatting object. <trait>is-first</trait> is <code role="value">true</code>
for the first area (or only area) generated and returned by a formatting object,
and <trait>is-last</trait>
is <code role="value">true for</code> 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 <specref ref="common-font-properties"/>)
which are used to request a font that is deemed to be used
within that area. The <trait>nominal-font</trait> for an area is
determined by the font traits and the character descendants of the area.
(see <specref ref="fontprops"/></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 descendant glyphs or other 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 is either the
<term>normal-allocation-rectangle</term> or the <term>expanded-allocation-rectangle</term>.
The <term>normal-allocation-rectangle</term>
extends
to the content-rectangle
in the block-progression-direction and to the border-rectangle in the
inline-progression-direction. The <term>expanded-allocation-rectangle</term>
extends
outside the border-rectangle by an amount equal to the space-after in the
block-progression-direction, an amount equal to the space-before in the opposite
direction, an amount equal to the space-end in the inline-progression-direction,
and an amount equal to the space-start in the opposite direction. Unless
otherwise specified, the allocation-rectangle for an area is the
normal-allocation-rectangle.
</p>
<figure>
<graphic source="AllocationRectInline.4.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="AllocationRect.2.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. <spot id="edges_may_not_correspond"/>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>alignment-point</term> determined by the formatter,
on the start-edge
of its allocation-rectangle; for a glyph-area, this is
a point on the start-edge of the glyph on its alignment baseline (see below).
This is script-dependent and does not necessarily correspond to the
(0,0) coordinate point used for the data describing the glyph shape.</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. These definitions are recursive in nature and some cases may depend
upon simpler cases of the same definition. This is not circularity but rather a
consequence of recursion. The intention of the
definitions is to identify areas at any level of the
tree which have only space between them.</p>
<p>The <trait>area-class</trait> 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>
<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>
<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>
<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>

<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 areas (either two inline-areas or one inline-area
and one line-area),
together with the notion of
<term>fence before</term> and <term>fence after</term>; 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 a
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 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>A</var> is an inline-area or line-area, <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>B</var> is an inline-area or line-area, <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 each either an inline-area or a line-area, and either</p>
    <p>a. both <var>A</var> and <var>B</var> are inline-areas,
    <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 an inline-area which 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 an inline-area which is the last normal child of an inline-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>P</var> and <var>B</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 an inline-area which 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 an inline-area which is the first normal child of an inline-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>P</var> and <var>B</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><spot id="fo0001sca_a"/>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-identifier</trait> trait whose value is a baseline identifier
corresponding to the type of alignment expected for inline-area descendants of that area,
and each inline-area has an <trait>alignment-baseline</trait> which specifies how the
area is aligned to its parent. These traits are interpreted as described in section
<specref ref="font-model"/>.</p>
<p>For each font, an <trait>actual-baseline-table</trait> maps these identifiers
to points on the start-edge of the area. <spot id="area-dominant-baseline-abuse"/>By abuse of terminology, the line in the inline-progression-direction
through the point corresponding to the dominant-baseline-identifier is called
the "dominant baseline."</p>
<p>The <trait>text-altitude</trait> of an area is defined in terms of the actual-baseline-table
for the nominal-font of that area, and is normally a length equal to the distance between the
dominant baseline and the text-before
baseline. This is modified if the <trait>font-height-override-before</trait> has a value
other than <code role="value">use-font-metrics</code>. The <trait>text-depth</trait> is normally defined
as a length equal to the distance between the dominant baseline
and the text-after baseline. This is modified if the <trait>font-height-override-after</trait>
has a value other than <code role="value">use-font-metrics</code>.
</p>
</div3>
</div2>
<div2 id="spacecond"><head>Spaces and Conditionality</head>
<p>A space-specifier is a compound datatype whose components are minimum, optimum,
<spot id="aj000035_6a"/>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, <spot id="aj000035_8a"/>forcing 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 <spot id="aj000029_24a"/>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 <spot id="aj000035_7a"/>reference-area 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 <spot id="aj000035_7b"/>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 <trait>line-stacking-strategy</trait> 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 <trait>space-before</trait> and <trait>space-after</trait> traits
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 <trait>start-indent</trait> and <trait>end-indent</trait> 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>
<div3 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
<spot id="fo01jr_2a"/><trait>start-intrusion-adjustment</trait>
<spot id="fosg_1a"/>(as defined below), 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
<spot id="fo01jr_2b"/><trait>end-intrusion-adjustment</trait>
<spot id="fosg_1b"/>(as defined below),
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="RectsForModel.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

(<specref ref="area-geo"/>)
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>
</div3>
<div3><head>Intrusion Adjustments</head>
<p><spot id="fosg_1c"/>Intrusion adjustments (both start- and end-) are defined to account for the
indentation that occurs as the result of side floats.</p>
<p>If <var>A</var> and <var>B</var> are areas which have the same nearest reference area ancestor, then <var>A</var>
and <var>B</var> are defined to be <term>inline-overlapping</term> if there is some line
parallel to the inline-progression-direction, which intersects both the
allocation-rectangle of <var>A</var> and the allocation-rectangle of <var>B</var>.  If the distance in
the block-progression direction from the after-edge of the allocation-rectangle
of <var>A</var> to the before-edge of the allocation-rectangle of <var>B</var> some nonnegative number
<var>y</var>, then <var>A</var> and <var>B</var> are defined to <term>have clearance of y</term>.</p>
<p>If <var>B</var> is a block-area then its <term>before-intrusion-allowance</term> is defined
to be the sum of the border-before-width and padding-before-width values of all
areas which are ancestors of <var>B</var> and descendants of <var>B</var>'s nearest ancestor
reference-area.</p>

<p>If <var>A</var> is an area of class <code role="value">xsl-side-float</code> and <var>B</var> is a block-area, and <var>A</var> and <var>B</var> have
the same nearest reference area ancestor then <var>A</var> is defined to
<term>intrude</term> on <var>B</var> if:</p>
<ulist>
<item><p><var>A</var> and <var>B</var> are inline-overlapping, or</p></item>
<item><p><var>A</var> and <var>B</var> have clearance of <var>y</var>, where <var>y</var> is some value greater than zero and
less than the before-intrusion-allowance of <var>B</var> (this is to account for
irregularly-drawn borders and padding); or</p></item>
<item><p><var>A</var> has float="start", <var>B</var> is a descendant of an area <var>L</var> generated by an
fo:list-item-body, <var>A</var> intrudes on some line-area or reference-area descendant <var>D</var> of
the sibling area of <var>L</var>, and <var>D</var> and <var>B</var> are inline-overlapping. (This is to ensure
that intrusion persists long enough so that the list-item-body does not drift to
the other side of the list-item-label.)</p></item>
</ulist>
<p>If <var>A</var> is a block-area with float="start", then the start-intrusion value of <var>A</var> is
the distance from the start-edge of the content-rectangle of the parent of <var>A</var> to
the end-edge of the allocation-rectangle of <var>A</var>. If <var>A</var> is a block-area with
float="end" then the end-intrusion value of <var>A</var> is the distance from the start-edge
of the allocation-rectangle of <var>A</var> to the end-edge of the content-rectangle of the
parent of <var>A</var>.</p>
<p>If <var>B</var> is a block-area which is a reference-area or a line-area, then the
start-intrusion-adjustment is defined to be the maximum of the start-intrusion
values of the areas which intrude on <var>B</var>.  The end-intrusion-adjustment is defined
to be the maximum of the end-intrusion values of the areas which intrude on <var>B</var>.</p>
<p>If <var>B</var> is not a reference-area or line-area, then its start-intrusion-adjustment
and end-intrusion-adjustment are defined to be zero.</p>
</div3>
</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 the line area's 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-altitude, and whose after-edge is
separated from the baseline-start-point by the text-depth. 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="InlineExampleMixed.2a.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> 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-dimension is determined as follows. 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 extent of the
per-inline-height-rectangle in the block-progression-direction is then defined to
be the minimum 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 <trait>line-height</trait> 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 an actual-baseline-table
for its nominal-font. It has
a <trait>dominant-baseline-identifier</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 extends from its dominant baseline (see

<specref ref="area-font"/>) by its
after-baseline-height in the block-progression-direction, and in the opposite
direction by its before-baseline-height; in the inline-progression-direction it
extends from the start-edge of the allocation-rectangle of its first child to
the end-end of the allocation-rectangle of its last child.</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>
<div3 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 the <term>dominant baseline</term>,
as defined above

(<specref ref="area-font"/>).</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 dominant baseline of <var>P</var> to the
alignment-point of <var>I</var> equals the distance between the dominant
baseline
of <var>P</var> and the point corresponding to the alignment-baseline of <var>I</var>
(as determined
by the <trait>actual-baseline-table</trait> 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
dominant baseline of any
intermediate area.</p><p> The first summand is computed to compensate for
mixed writing systems with different baseline types, and the other
summands involve deliberate baseline shifts for things like superscripts
and subscripts.</p></item>
</olist>
</div3>
<div3 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 alignment-point and dominant-baseline-identifier 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
actual-baseline-table are the same for all glyphs in a font.</p>
</div3>
</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.
<spot id="fosg_0c"/>Deletions occur when a glyph-area which is last
within a subset S<sub>i</sub>, has a
<trait>suppress-at-line-break</trait> value of <code role="value">suppress</code>,
provided that i &lt; n and B<sub>i+1</sub> is
a line-area.  Deletions also occur when a glyph-area which is first within a subset S<sub>i</sub>,
has a <trait>suppress-at-line-break</trait> value of <code role="value">suppress</code>,
provided that i &gt; 1 and B<sub>i-1</sub> is a line-area.
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-identifier, 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><spot id="fo0001_16c"/>Each subset consists of a sequence of inline-areas,
or of a single block-area.</p>
</item>
<item><p><spot id="fo0001_16d"/>The ordering of the partition follows
the ordering of the formatting object tree, as defined above.</p>
</item>
<item><p><spot id="fo0001_16e"/>The partitioning occurs at legal line-breaks, as defined above.</p>
</item>
<item><p><spot id="fo0001_16f"/>The partition follows the ordering of the area tree,
except for certain glyph substitutions and deletions, as
defined above.</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
<spot id="fosg_2a"/><term>column-areas</term> are
normal-flow-reference-areas generated from a region-body, or
region-reference-areas generated from other types of 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 "keep-with-previous", "keep-with-next", and
<spot id="fo0001jc_a"/>"keep-together" 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 intrinsic 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
parallel to the
start-edge and end-edge of the content-rectangle of its parent
viewport-area. The start-edge of its content-rectangle
is offset from the start-edge of the content-rectangle of its parent viewport-area
by an <term>inline-scroll-amount</term>, 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>block-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 inline-scroll-amount and block-scroll-amount are
determined by a scrolling mechanism, if any,
provided by the user agent. Otherwise, both are 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>The stacking layer of an area is defined by its stacking context and
its z-index value. The stacking layer of an area <var>A</var> is defined to be less
than that of an area <var>B</var> if some ancestor-or-self <var>A'</var> of <var>A</var>
and <var>B'</var> of <var>B</var> have the same stacking context and
the z-index of <var>A'</var> is less
than the z-index of <var>B'</var>. If neither stacking layer is less than the
other then they are defined to have the same stacking layer.</p>

<p>If <var>A</var> and <var>B</var> are areas, and the stacking layer
of <var>A</var> is less than the stacking layer
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
stacking layer, 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 stacking layer), 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 stacking layer 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>alignment-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>
<item><p>alignment-baseline</p></item>
<item><p>baseline-shift</p></item>
<item><p>nominal-font</p></item>
<item><p>dominant-baseline-identifier</p></item>
<item><p>actual-baseline-table</p></item>
<item><p>script</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., <spot id="c15i9"/>some values 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
<spot id="c11i26"/>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
<spot id="c11i27"/>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 <spot id="aj000035_10b"/>correspondence 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-prog