Making a TOC of nested list elements for an XHTML document by hand or by code is usually among the more tiresome or difficult tasks. With XSLT 2.0 it is relatively easy to transform the XHTML document to itself (identity transform) and let extra templates add the TOC, the links and the numbers.
With a schema-aware XSLT 2.0 processor we can test if XML output is valid as we create it. Nice that no XML with a schema, e.g. xhtml, can be generated in our system if it is not valid. Sorry, but schema-awareness is not mature yet.
When we transform XHTML to XHTML using the identity template or "@*" in the match attribute we suddenly end up with shape="rect" attributes in all anchor elements of the XHTML output document.
It is easy to transform many XML documents into one XML document. But a few tricks and a little experience is needed especially when using XHTML as input and output. In the following we will look at different ways of loading all the XML files into the transformation process in XSLT 1.0 and XSLT 2.0.
Considering how useful it could be to transform the XHTML based web to another format or to use XHTML as an XML data store, it is surprisingly tricky to transform XHTML. Most XSLT developers need to be told the secrets of XHTML transformation in order to do it.
Updated 2007-09-21