Introduction to XSL
Added 26 Jul 2008
Building stylesheets for a large, rich XML vocabulary is a challenging exercise. This paper explores some of the design issues confronted by the author in designing XSL stylesheets for DocBook, an XML DTD maintained . It is particularly well suited to books and papers about computer hardware and software (though it is by no means limited to these applications).
DocBook consists of nearly 400 tags. The HTML and Formatting Object stylesheets each consist of roughly 1000 templates spread over about 30 files.
The design for the DocBook XSL Stylesheets attempts to meet the following goals:
-
Full support for both HTML and XSL Formatting Object presentations.
-
Utility for a wide range of users, with varying levels of technical skill.
-
Provide a framework on top of which additional stylesheets can be written for schemas derived from DocBook.
-
Support for a wide range of projects (books, articles, online- and print-centric presentations, etc.)
Although not all of these goals have been completely achieved, progress has been made on all of them. Five techniques stand out as important factors in achieving these goals: modularity, parameterization, self-customizing stylesheets, “literate” programming, and extensions. The rest of this paper will discuss these techniques in detail.