Jesper Tverskov, September 27, 2012

Articles and tutorials about XML-technologies. Also a companion website for my XML training courses.


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.


Disable-output-escaping and xsl:character-map

DOE is short for "disable-output-escaping". DOE is the name of an attribute we can use in xsl:value-of and in xsl:text. XSLT processors are not required to support it, and in XSLT 2.0 DOE is deprecated. We should use xsl:character-map instead. "Character-map" is a general method for replacing a character with a string when output is serialized.

Understanding xml:space

The xml:space="preserve" attribute is common in some XML documents. But what the attribute means is obscured by the fact that it is often used for no good reason. It could be there in an element in the source code because some developer inserted it as an experiment and forgot to delete it again.


Transform XML to CSV with XSLT pipeline

This tutorial is a showcase for the templating power of XSLT. The XML to CSV solution is a pipeline of 7 xslt stylesheets providing user-defined pre-processing and automatic flattening and equalizing. Comma, quote, linebreak, leading and trailing whitespace are supported in data.


Styling XML with CSS

All text books about XML have long chapters about how to style XML with CSS. This is misleading because it is used very little in the real world. It is fair to say that CSS for XML is only relevant as en exception to the rule. Students of XML should know that we can style XML with CSS but actually doing it is mostly a waste of time.

Name, NmToken, QName, NCName

Since there are restrictions on what can be used as a name for elements and attributes, the XML standards have come up with a host of "name" terms that are bound to confuse beginners in the subject. Name, NmToken, QName and NCName are also datatypes and XSLT/XPath and XQuery even have functions about some of them. Regular Expressions have \i and \c for initial character in Name and allowed characters in NmToken.

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.

xsl:namespace in XSLT 2.0

The x sl:namespace element is most often useful if namespaces are created dynamically or if they are part of content of elements and attributes as QNames, or if we for cosmetic reasons want to transfer namespace declarations from inner elements to outer element in output.

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.


More: All Articles

Danish language


På dansk i hele verden.

English language


In English all over the world.

Friendly Tests

Test, training and quiz.