在紧凑框架中使用XSL转换XML(c#) [英] Transform XML with XSL in compact framework (c#)

查看:64
本文介绍了在紧凑框架中使用XSL转换XML(c#)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道紧凑框架不支持XslTranform,但是如果你想用XSL表转换XML文档,你可以解决这个问题吗?

I know compact framework doesn''t support XslTranform, but is ther any way that you can work around this if you want to transform a XML-document with a XSL sheet?

推荐答案

检查此 http://www.xprogramming.com/ xpmag / ac ... xperiments.htm



检查这个 http://www.xprogramming.com/xpmag/ac...xperiments.htm



谢谢,但你不能在紧凑的框架中使用XslTransform: - (

Thanks, but you cant use XslTransform in compact framework :-(


你可以使用MSXML DOM对象,通过导入类型库或反射。

请参阅这2个C#示例

要通过XML应用XSL模板,请使用DOM对象的transformNode()方法。


作为参考,我给你一个JavaScript示例:

[html]< PRE nd =" 52" ;>< html>

< body>


< script type =" text / javascript">


//加载XML

var xml = new ActiveXObject(" Microsoft.XMLDOM")

xml.async = false

xml.load(" cdcatalog.xml")

//加载XSL

var xsl = new ActiveXObject(" Microsoft.XMLDOM")

xsl.async = false

xsl.load(" cdcatalog.xsl")


//转换
document.write(xml.transformNode(xsl))


< / script>


< / body>

< / html>

< / PRE> [/ html]


您可以使用您现有的版本系统:

MSXML2.DOMDocument.3.0,

MSXML2.DOMDocument.4.0或

Microsoft.XMLDOM


如果不确定你有什么版本,运行Start / Run / regedit,然后搜索它。
You can use MSXML DOM object, by importing the type library or through Reflection.
See these 2 C# examples.
To apply the XSL template over XML use the transformNode() method of the DOM object.

For reference, I give you a JavaScript example:
[html]<PRE nd="52"><html>
<body>

<script type="text/javascript">

// Load XML
var xml = new ActiveXObject("Microsoft.XMLDOM")
xml.async = false
xml.load("cdcatalog.xml")

// Load XSL
var xsl = new ActiveXObject("Microsoft.XMLDOM")
xsl.async = false
xsl.load("cdcatalog.xsl")

// Transform
document.write(xml.transformNode(xsl))

</script>

</body>
</html>
</PRE>[/html]

You can use the version existing on your system:
MSXML2.DOMDocument.3.0,
MSXML2.DOMDocument.4.0 or
Microsoft.XMLDOM

If not sure what version you have, run Start/Run/regedit, and search for it.


这篇关于在紧凑框架中使用XSL转换XML(c#)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆