Benefits of polyglot XHTML5

HTML5 has so many syntax options that at least some web designers and developers prefer to use a consistent subset. In HTML5 almost anything in both old XHTML and HTML are allowed in the same valid document. With no self-imposed restrictions, HTML5 markup has a tendency to attract dirt attracting more dirt. In this tutorial we don't look at all the nice new features in HTML5. We focus on what basic subset to use.


Google's Writely and XSLT for web pages

This article is written with Google's Writely and can at any time be edited by me at Google Docs. This XHTML webpage, on the other hand, is at my own website. It's a transformation of the page at Google Docs using XSLT. A script, called from my document at Google Docs, takes care of publication at my website.

XHTML sections: implicit2explicit-hierarchy.xsl

How to unflatten XML often comes up in XSLT Help Fora like the xsl-list. In this tutorial I give a complete and detailed example of how to transform an XHTML document using h1-h6 headings into an explicit hierarchical structure of nested sections.



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.

Valid XHTML with schema-aware XSLT 2.0

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.

The shape="rect" attribute in xhtml to xhtml

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.


Transform XHTML documents into one big 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.


Transform XHTML to XHTML with XSLT

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: 2011-09-03