My previous chatter on XSLT was possibly stated a little to strong. I do not want to ban every use(r) of it, I do even see places where it is useful. At the time of writing I was pissed of to be confronted with it without asking for it. The comments to my dislikes were quite interesting (thanks Frans an Joseph), reason enough to try to clarify my opinion.
Let's take this XSLT sylesheet (From Dino Esposito's book "Applied XML-programming"
<xsl:stylesheet
xmlns:xsl:"http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:template match="/">
<HTML>
<BODY>
<H1>Northwinds's Employees</H1>
<TABLE>
<xsl:apply-templates
select="MyDataSet/NortwindEmployees/Employee"
</TABLE>
</BODY>
</HTML>
</xsl:template>
Imho, the yellow part is just data, the processor will copy it straight to the resulting document. It is surrounded by xsl-code which will be processed by the xsl processor. Where the data stops and the code begins is completely unclear to the reader of the document. And even the XSL processor makes mistakes, like the one in IE trying to display an aspx document.
To everything else than the xslt processor the whole stylesheet is data, after all it is just a XML document. A XAML file is a XMLdocument as well, in here the pieces of code can be recognized as being CDATA sections. A XAML file is no code, it is processed to generate the source of real C# classes, a CData section is not processed. This resulting source will be fed to the compiler to produce something executable. Here the distinction between code and (meta)data is a little clearer.
The latter brings me to my other problem with xslt. The only development tool I really trust is a compiler. It will check every character of my source and immediately report on every typo or stupidity. When it comes to processing the style sheet I will not be aware of any problem until the crash has happened. So when I have a choice I'd rather use some XML(xpath)document objects. Of course this is partly a matter of taste. I am very strongly biased to stay away from xslt, but will it stay away from me ?
Blog on,
Peter