The End of XSLT for .NET Programmers?

Posted by Jonathan Allen  From/InfoQ

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.

 感谢原创者的辛勤劳动,希望对您有所帮助,转载请注明原出处。
 您可能对 [Visual Studio.NET] 的这些文章也感兴趣:

微软MIX08大会之后的产品发布(Silverlight、IE8、ASP.NET MVC)
基于XNA的3D图形GPU渲染技术
使用VB.NET加密文件
Visual Studio 2008 和 .NET Framework 3.5 Service Pack 1 Beta
使用.NET Framework中新的日期时间类型
Visual Studio终于开始关注性能问题
详解.NET中的动态编译
CLR和JVM的动态语言支持
Java和.NET交互工具JNBridgePro发布4.0版本
深入学习heritrix---体系结构(Overview of the crawler)