[This local archive copy mirrored from the canonical URL: http://www.berkshire.net/~norm/posters/sgml97/xsl.html, 980309; please use the official version on this URL if possible.]

The Extensible Style Language (XSL)

The Extensible Style Language (XSL) is described in a recent submission to the W3C. It is a stylesheet language based on both Cascading Style Sheets (CSS) and the Document Style Semantics and Specification Language (DSSSL, ISO/IEC 10179:1996). XSL provides sophisticated formatting capabilities for both online and print applications.

XSL provides a superset of the functionality available in CSS. Additional features include:

Key Design Principles

Stylesheet Structure

The heart of an XSL stylesheet is a collection of rules. Each rule contains a pattern and an action. Patterns locate elements within the source document, actions determine how these elements should be formatted.


A simple rule looks like this:

  <target-element type="emphasis"/>

  <sequence font-posture="italic">

This rule makes the content of <emphasis> elements in the source document appear in italics in the formatted output.


Patterns express the location of an element in the source document. The simplest pattern simply names the target element. More complex patterns can include ancestors and descendants of the target element along with specific attribute values and uniqueness constraints. For example, the following pattern will only match the first <para> of a <listitem> in an <itemizedlist>, and only if the list item has an override attribute with the value U93opencircleU94:

<element type="itemizedlist">
  <element type="listitem">
    <attribute name="override" value="opencircle"/>
    <target-element type="para" position="first-of-any"/>

Additional pattern elements can detect the presence or absence of an attribute (without a specific value), select arbitrary elements and siblings, make selections based upon ID and CLASS and express importance and priority, as per CSS. There are also elements which match the root element of the document and provide a default action if no specific pattern matches. A conflict resolution mechanism is employed to assert that only a single pattern ever matches a given element.

Multiple actions for the same pattern can be introduced with modes. Modes allow a stylesheet to process the same elements in more than one context. This allows section titles to be rendered differently in a Table of Contents than they are in the body of the document, for example.


Actions are expressed using flow objects. Flow objects encapsulate the general nature of a formatted elementU96this is a paragraph, this is a rule, this is a table, etc. Characteristics attached to a flow object provide additional information about how the object is to be formatted (use an italic font, indent by a certain amount, etc.).

In the current proposal for XSL, there are two distinct kinds of flow objects, DSSSL flow objects and HTML flow objects.

The action portion of a rule describes the sequence of flow objects that should be generated when processing the selected element. Specifying the formatting of an element may involve producing not only a flow object for that element, but possibly flow objects for the children of that element or other arbitrary elements as well.

For example, here's an action that might be used for the first paragraph of a list item in an itemized list:




This action uses a hanging indent and a line field to produce a bullet before the paragraph.

Stylesheet Information

This poster provides only the briefest introduction to XSL. For more information, please consult the following resources:


The XSL Submission.


The public Working Draft of CSS2.


Information about DSSSL

Poster Information

This poster was prepared by Norman Walsh of ArborText, Inc. The SGML source of the poster is an Article from the DocBook V3.0 DTD. It was written in Adept 7.0 and printed with a DSSSL stylesheet using Jade. The resulting 8x11 pages were enlarged at a local copy shop.

An online version is available at http://www.berkshire.net/~norm/posters/sgml97/xsl.html.

Norman Walsh, <nwalsh@arbortext.com>
ArborText, Inc.
1000 Victors Way
Ann Arbor, MI 48104