Friday 7 March 2008

The End of XSLT for .NET Programmers?

Microsoft's VB team is starting a series of articles on how to use XML Literals. Many of these articles will demonstrate how to replace XSLT code with VB by making direct comparisons between the two languages.

XML Literals is a syntax first pioneered for Haskell and later brought to Microsoft for use in C#. Not finding a home in either language, the Visual Basic team snapped it up and made it a cornerstone of VB 9. This should not be too much of a surprise, as the Haskell syntax was heavily influenced by VBScript's inline HTML notation.

In the first XML Cookbook article, Doug Rothaus demonstrates the VB equivalents to XSLT's , , , , , and elements. He also shows how to use XML Axis Properties in place of XPath.

Though the examples are simple, the VB versions are consistently shorter than the XSLT versions. Most of the gains are from moving away from XSLT's rather verbose syntax. Though not demonstrated here, VB also has an advantage in that you can call out to normal .NET code when needed.

. . . full article

1 comment:

Miguel de Melo said...

Surprise surprise, Microsoft just went out of their way to break yet another standard, and give it some fancy name. The so originally called "XML Literals" looks remarkably identical to the just W3C Standard XQuery, that the rest of the XML community have been working on so had together for years, to make sure it works for everyone, and so that we all agree on a common path.

So I am not surprised they did it again, after all is part of Microsoft's philosophy, rip off what someone else is doing well, make it worse, and make a bucket out of it . . .
VB XML Cookbook, Recipe 1: XML Transformations using XML Literals (Doug Rothaus)