| Overview of the XML Family of Standards | Table of contents | Indexes | Using an XML Audit to Move SGML Data towards XML | |||
Overview of XSL |
Ann Arbor ![]() Arbortext, Inc. ![]() Grosso, Paul ![]() Michigan ![]() | Paul
Grosso
VP Research, Arbortext, Inc.
Biographical notice Paul Grosso is Vice President and co-founder of ArborText, Inc. He currently oversees standards participation and research and strategic planning related to technology as well as serving as a key technical resource to ArborText's software development group. Paul has served on various ISO, ANSI, and industry standards working groups for the past decade. He served on the Board of Directors of SGML Open, the international vendor consortium dedicated to improving the practical interoperability of SGML in the marketplace, from its inception in 1993 to June of 1997 during which time he held the position of Chief Technology Officer. He currently serves as ArborText's chief representative to the World Wide Web Consortium, sitting on the XML, XSL, and DOM working groups and acting as ArborText's representative on the W3C Advisory Committee. Prior to co-founding ArborText in 1982, Paul worked as a programmer in the area of computer systems and publishing software for eight years in various capacities for The University of Michigan Computing Center and the Mathematical Reviews division of the American Mathematical Society. Paul received his Ph.D. in Computer and Communication Sciences from The University of Michigan. He received the Graphics Communication Association Tekkie award in 1992 for meritorious achievement in the standards and technical documentation industry. |
XML ![]() XSL ![]() style ![]() | Abstract |
| The newest Web standard for style is known as Extensible Stylesheet Language (XSL). Although XSL is still on the drawing board, it holds tremendous potential for interacting with XML. What is XSL? What is the status and schedule for this promising W3C standard? This presentation provides an overview and the latest information on XSL. |
Concepts and background |
Why stylesheets? |
| A stylesheet is not required to display formatted information. Page description languages (e.g., PostScript) describe already formatted information. Format-specific marked (e.g., troff, TeX) embed format information along with the source information. In the case of presentational markup--such as a DTD with elements such as bold, italic, center--the tag names imply a format so that a stylesheet my not be needed. And even when the markup is logical (describing the structure of the information rather than its presentation), style information can be embedded within the same entity as the markup. |
| However, there are benefits to separating the content and structure of information from its presentation. If presentational information is maintained in a separate stylesheet, the way a certain piece of information is presented is divorced from the information itself. This allows for the following benefits: |
| Using separate stylesheets written in standard formats: |
Placing XSL into perspective |
| The XSL design effort was kicked off with a co-submission to the W3C by ArborText, Inso, and Microsoft acknowledged 1997 September 10. The subsequent XSL working group was chartered in January 1998, and it published its first working draft in August 1998. The current public schedule plans for XSL to be a Proposed Recommendation in May 1999. |
| XSL builds on both DSSSL and CSS. XSL is designed to be accessible to the "markup" level user for most requirements, though it plans to provide for extensibility for more esoteric needs. Basic capabilities provided by XSL will allow: |
| XSL and CSS plan to share a common formatting model where functionality overlaps. XSL will include online, audio, and interactive functionality as in CSS. XSL allows for source tree transformations and addresses complex formatting requirements. |
Overview of XSL |
| A stylesheet specifies how a document (more generally, class of documents) should be presented; it maps source elements to presentational forms. In a sophisticated, general purpose style language like XSL, mapping from source elements to presentational forms can be viewed as a two step process: first the source document may be transformed in a number of ways, and then style is attached to the transformed document. |
The XSL Model |
| In the XSL model, the input source document is treated as a tree of objects. The stylesheet maps that tree into a resulting tree of XML objects; those objects may be a special set--called formatting objects--defined by XSL. An XSL stylesheet consists primarily of template rules that describe, for each input source object, what to produce in the result tree. When the result tree consists of formatting objects, it is called the formatting object tree. To produce composed output, a formatting object tree would be processed by a formatter. Examples of formatting object types include paragraph, character, horizontal-rule, etc. A formatting object also has a set of named characteristics (properties), which further specify the formatting for that object. Instead of formatting objects, the result objects may be other XML objects; in this case, the result of processing the XSL stylesheet is another XML tree (which could, presumably, be written out as an XML--or perhaps HTML--document instance). |
| An object in the source tree is processed to create a result tree fragment. An object is processed by finding the template rule for that object and then processing the object with that rule. During the processing of a template, along with specifying how the current source object affects the result tree, the template generally also indicates what source object or objects to process next (usually the current object's children). The processing of the source tree is continued recursively until no new source objects are selected for processing. |
Some simple XSL |
| A stylesheet contains a set of template rules. A template rule is specified with the xsl:template element. The xsl:template element has a match attribute (whose value is a match pattern) that identifies the source object to which the rule applies; the content of the xsl:template element is the template. A template is instantiated for a particular source element to create part of the result tree. A template can contain elements that specify literal result element structure (e.g., generated text) as well as elements that are instructions for creating result tree fragments from objects in the source tree. |
| The following is an example of a simple XSL stylesheet that constructs a result tree for a sequence of para elements. The result-ns="fo" attribute indicates that a tree using the formatting object vocabulary is being constructed. The rule for the root node specifies the use of a page sequence formatted with any font with serifs. The para elements become block formatting objects which are set in 10 point type with a 12 point space before each block. |
| <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl" xmlns:fo="http://www.w3.org/TR/WD-xsl/FO" result-ns="fo"> <xsl:template match="/"> <fo:page-sequence font-family="serif"> <xsl:process-children/> </fo:page-sequence> </xsl:template> <xsl:template match="para"> <fo:block font-size="10pt" space-before="12pt"> <xsl:process-children/> </fo:block> </xsl:template> |
| A pattern is a string which is matched against an element in the source document. The most common pattern specifies the element type name of a matching element. For example, the pattern emph matches an element whose type is emph. More complex patterns specify the element types of ancestors of a matching element. For example, the pattern "olist/item" matches an element whose type is item with a parent element of type olist. Each element type in the list of ancestors may be followed by a list of "qualifiers" separated by commas. For example: |
| list[attribute(ordered)="yes")]/item |
| matches an element whose type is item which has a parent of type list with an ordered attribute equal to yes. |
| The pattern language of XSL allows for a powerful selection mechanism that, combined with the templates, allows for the specification of a wide range of transformations on XML documents. |
XSL references |
| Overview of the XML Family of Standards | Table of contents | Indexes | Using an XML Audit to Move SGML Data towards XML | |||