惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

aimingoo的专栏
aimingoo的专栏
宝玉的分享
宝玉的分享
博客园 - 【当耐特】
博客园 - 司徒正美
L
LangChain Blog
有赞技术团队
有赞技术团队
大猫的无限游戏
大猫的无限游戏
Stack Overflow Blog
Stack Overflow Blog
Engineering at Meta
Engineering at Meta
U
Unit 42
Microsoft Azure Blog
Microsoft Azure Blog
I
InfoQ
博客园 - 叶小钗
H
Hackread – Cybersecurity News, Data Breaches, AI and More
J
Java Code Geeks
月光博客
月光博客
量子位
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
博客园_首页
Last Week in AI
Last Week in AI
人人都是产品经理
人人都是产品经理
Google DeepMind News
Google DeepMind News
云风的 BLOG
云风的 BLOG
D
DataBreaches.Net

博客园 - 秋枫

使用BizTalk Server常见问题处理 BizTalk Server中简单xml架构使用举例 CodeProject.com上微软BizTalk平台技术文章集锦 BizTalk Server 2006中使用MQSeries适配器问题处理 基于.Net平台应用程序唯一运行实例实现 使用BizTalk Server的Sql适配器出现“新事务不能登记到指定的事务处理器中”异常的处理 谈基于.net平台windows开发中的模式窗体 小提国内一些提供RSS服务的网站生成Rss文件问题 Visual studio .net 的“隐蔽性”和容易“忽略”的功能 使用sqlcmd(osql) 实用工具列出本地网内的Sql Server 服务器 《敏捷注册表》1.0使用说明书 《敏捷注册表》1.0概述 使用从BindingManagerBase.PositionChanged 事件的注意点 使用Microsoft SQL Server 2000的XML查询 asp.net中显示DataGrid控件列序号的几种方法 使用.net framewrok 1.1版System.Windows.Forms.TreeView的一个问题 使用.net framewrok 1.1版注册表API的局限和解决 使用SaveFileDialog需要注意的情况 使用.net framework中常用类在2.0版中的新功能
Visual studio 2005下xml的xsl转换调试
秋枫 · 2006-04-19 · via 博客园 - 秋枫

.net Framework 2.0中,使用XslCompiledTransform类取代了原来1.x中的XslTransform类,笔者测试了一下对xml的转换处理性能确实提高许多。XslCompiledTransform支持 XSLT 1.0 语法的 XSLT。突出的新功能是她提供了在VS 2005中对xslt样式表文件的调试能力。编写代码过程相当简单。

XslCompiledTransform xslt = new XslCompiledTransform(true);

只要在XslCompiledTransform类的构造函数中传入是否启用调试参数就行。默认构造函数不开启调试模式。注意需要引用System.Xml.Xsl命名空间。

以下是调试过程中的两幅截图。
xslt_debug1.jpg

(1,变量智能感应)

xslt_debug2.jpg
(
2,局部变量窗口)

整个代码也就几行。

using System;

using System.Xml;

using System.Xml.Xsl;

/*===============================================

  秋枫 2006-04-19  http://blog.csdn.net/zhzuo       

=================================================*/

namespace Zhzuo.VS2005Test.ConsoleTest

{

    class Program

    {

        static void Main(string[] args)

        {

            // Enable XSLT debugging.

            XslCompiledTransform xslt = new XslCompiledTransform(true);

            // Load the style sheet.

            xslt.Load("d:\\emserpMessage.xslt");

            // Create the writer.

            //XmlWriterSettings settings = new XmlWriterSettings();

            //settings.Indent = true;

            //XmlWriter writer = XmlWriter.Create("d:\\output.xml", settings);

            // Execute the transformation.

            //xslt.Transform("d:\\20060418030410.xml", writer);

            //writer.Close();

            xslt.Transform("d:\\20060418030410.xml", "d:\\output.xml");

            Console.ReadLine();

        }      

    }         

}