栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > 其他 > xml语言

通过XSLT将xml转换为html的代码示例

xml语言 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

通过XSLT将xml转换为html的代码示例

c#使用XSLT将xml文档转换为html文档使用xslt可以将xml文档转成html,如下c#函数:需要引用下面的命名空间:using System.Xml; using System.Xml.Xsl;   方法实现:public static string ConvertXML(Xmldocument InputXMLdocument, string XSLTFilePath , XsltArgumentList XSLTArgs) {    System.IO.StringWriter sw = new System.IO.StringWriter();    XslCompiledTransform xslTrans = new XslCompiledTransform();    xslTrans.Load(XSLTFilePath);    xslTrans.Transform(InputXMLdocument.CreateNavigator(), XSLTArgs, sw);    return sw.ToString(); }   示例xml文件如下:                               示例xslt文件如下:      

调用的c#代码:Xmldocument xDoc=new Xmldocument(); xDoc.Load(@"C:sample.xml"); string returnhtml = ConvertXML(xDoc, @"C:sample.xslt", new XsltArgumentList()); 将输入如下html:

Bollywood

Antra mali Deepika Padukone Mandira Bedi

Hollywood

Jennifer Lopez Jessica Alba

【相关推荐】

1. XML免费视频教程

2. XML技术手册

3. 李炎恢XHTML视频教程

以上就是通过XSLT将xml转换为html的代码示例的详细内容,更多请关注考高分网其它相关文章!

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/794344.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号