BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News The End of XSLT for .NET Programmers?

The End of XSLT for .NET Programmers?

This item in japanese

Bookmarks

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 <xsl:copy-of>, <xsl:for-each>, <xsl:template>, <xsl:if>, <xsl:value-of>, and <xsl:attribute> 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.

Rate this Article

Adoption
Style

BT