Does "XML transform" = "XSLT"? (Try Python instead!)

I see many job postings that ask for a person with skills writing XML transforms. The posts almost always end up assuming that such a person needs to be an XSLT expert. This need not always be the case! While it it is true that XSLT can be used to transform XML, there are reasons why you might want to consider doing XML transform using another programming language. My favorite language for transforms is Python.

Here is why I often choose to script in Python or PHP instead of using XSLT:

  • XSLT is a difficult language to learn and use. This leads to a chronic shortage of XSLT experts.
  • Other programming languages (such as Python and PHP) have the ability to parse, modify and create XML. There are many such languages that are general purpose in nature and allow the programmer to use variables, loops, and other programming constructs in a language that is easy to read, learn, and for which IDEs exist. There are lots of programmers available for these languages.
  • Python programs can be incorporated into an ant build, just as XSLT can.

The structured content on our DITA-based, content-rich, model sites is transformed and published using Python. To do that same task with XSLT would be very difficult.