Using TDD to produce High Quality XSLT

Return on experience

Christophe Marchand

Open to new opportunities
Oxiane

Abstract

This paper explains the benefits we had in using TDD to developp a Markdown to XML transformer.

It introduces TDD, Clean Code and Refactoring, and shows how to apply them to XSLT language.


Table of Contents

TDD : where does it comes from ?
The TDD loop and the refactoring phase
Writing a MarkDown to HTML converter with XSLT
Feature definition
Tooling
Methods
Implementation
Level 1 titles
Next titles and list items
Pro and Cons of using TDD for XSLT development
Bugs
Baby steps
Refactoring
Code Coverage
Data Coverage
Conclusion
Bibliography

At OXiane, we produce a lot of courses, we sell and teach. We were using office tools, like LibreOffice Writer and LibreOffice Impress. But it was difficult for us to make a clear distinction between a source document, that can be edited, and a production document, that is archived to know which slides has been used for which session. And being many writers to work together is not easy with such tools.

For this reasons, and for editorial contraints, we decided that a Oxiane Course will be a project, that contains sources for slides, source for exercise book, where sources are text files, and that we will build the production files by a build process.

This drives us to write various tools to transform text source files into PDF or HTML outputs. And we wanted to have high quality tools, so we decided to apply lessons learn from Software Craftsmanship.