06.27
Kindly excuse the “tackiness” (is that a word?) of the title of this blog post. I just wanted to express how elegant XSLTs (along with XPaths) are in the Web 2.0 world where most data are represented in XML. I think most of the “No SQL” initiative (along with the “flavor-of-the-recent-times” Cassandra DB) is based on the fact that a lot of data are represented that grows BOTH vertically (i.e., “number of records”) AND horizontally (“number of fields”)…which, IMO, XML is all about.
XSLTs, when used/coded properly, should be really used as “rules-based” (i.e., “xsl:apply-templates”) instead of “serial-based” (i.e., “xsl:for-each” + “xsl:call-template”), and making your XSLT rules-based can be daunting at first but becomes powerful in the long run. The only word I could describe it is that: beautiful. I think XSLT is the closest thing I could get to the days I was writing in Prolog in my Computer Science classes.
XSLTs (again, when coded properly) are EASY to manage. It is isolated. If you have a good XML IDE like Stylus Studio (Not that crap XML Spy), it’s easy to unit-test.
It’s rather stupefying why some “programming gurus” out there detest it. Honestly, I would lose respect to any programmer who doesn’t consider XSLT to programmatically manipulate of complex XMLs…especially those people who’d rather write multiple lines of C# involving XElement than write an XSLT…or worse, LINQ to XML (*shudder*).
Apparently, I’m not alone on this: XSLT has been around since 1997, and the 1.0 has been part of the W3C Recommendation since 1999. It’s not a fad. And XSLT 1.0–despite its limitations–is still yet to be trumped by 2.0 because it’s already full-featured in itself.
Don’t get me wrong, XSLT is not the solution to everything XML-related. However, itt should be part of any good programmer’s arsenal, along with that *other* awesome creation of Computer Programming world, Regular Expressions (that would be topic for another day).