Comment by ilitirit
11 years ago
You could do the exact same thing using XSLT. eg.
var result = new XSLTProcessor().importStylesheet(xsl).transform(....);
It's a bit of a pointless example because it really depends on the transformations you need. I'm sure in some cases XSLT would be better for the job, and in other cases another language. Most of the time it would generally just depend on your environment, available tools and skillset.
>I'm sure in some cases XSLT would be better for the job
In some (simple transformation) cases XSLT would be no worse, but mostly it would be worse. I can't see it being clearer or easier to maintain under any circumstances.
Once your code evolves toward doing anything mildly complicated you'll wish you never made your transformation in xslt.