Top Ten Data Crunching Tips and Tricks
Subject:   The XSLT example is...not so good
Date:   2006-02-17 11:07:35
From:   R.Rossney
Greg says that the first example "is almost trivial, since the text for each bullet point is wrapped in <t>...</t>. Take that away, so that whoever's creating the data has less typing to do...and the XSLT transformation nearly triples in complexity."

I don't see how. This:

<xsl:template match="text()">

is not three times as complex as this:

<xsl:template match="t">

In my experience, XSLT is not "fiendishly difficult to debug" at all, as long as you understand its processing model and follow good practices. It's certainly harder to hack something together in XSLT if you don't know what you're doing than it is in Perl. But if you have scaled its (nontrivial) learning curve, it's a very powerful and expressive language. And its freedom from side-effects makes your transforms remarkably stable and reliable.

Just don't try to use XSLT to transform data that is only in XML because some clown decided to jump on a bandwagon. I'm thinking here of Microsoft's incredibly unusable Excel XML format. Or formats I've seen where someone takes newline-terminated text data and turns it into XML by sticking <record> at the start of every line and </record> at the end. Oh, that's useful.