Code Samples

This section provides examples of working XML and XSL files for specific functions or results. Each example is accompanied by a brief description of how the XML and XSL code works to produce the desired output and the code is fully commented. You are welcome to download and modify the code for your own use as long as you retain the copyright notice at the top of each file. Future releases of this Web site will include code samples for functions such as producing PDF output from XML and creating automatic page navigation links for multiple page documents.

Footnotes

Anyone who has ever created or maintained a Web site knows the headaches created by inserting footnotes on a Web page. Here's an elegant solution using DocBook elements to identify footnotes in the XML file along with some efficient XSL transformations to position the footnotes properly on the Web page.

Tables

Tables come in all shapes and sizes and therein lies the problem. The example here employs a relatively short section of XSL code (about 100 lines) to transform a table of any size and configuration (including rowspans and colspans) into the desired HTML table. It uses DocBook elements to describe the table in the XML file.