C.2. The Stylesheet

C.2.1. Headers

The stylesheet starts with standard “boilerplate” headers.

Declare it as an XML document:

<?xml version="1.0" encoding="ISO-8859-1"?>

A copyright notice:

<!--
Copyright (C) 2000 Oren Ben-Kiki
This stylesheet is public domain. However, if you
modify it or decide to use it as part of an XSLT
benchmark/testing suite, I'd appreciate it if you
let me know at oren@ben-kiki.org
-->

A descriptive comment:

<!--
This XSL stylesheet will convert an XML document of
the form:
<BoardSize>8</BoardSize>
Into an HTML document listing all 8x8 chess boards
containing 8 queens such that no one threatens
another.
It uses XSLT version 1.0, as per
http://www.w3.org/TR/1999/REC-xslt-19991116
-->

Now we get to the stylesheet itself. ...

Get XSLT and XPATH: A Guide to XML Transformations now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.