如何在C#2.0使用XSLT转换的XMLDocument如何在、XMLDocument、XSLT

由网友(- 纯二° Everylove`)分享简介:我使用C#2.0和我有低于code:I am using C# 2.0 and I have got below code:XmlDocument doc = new XmlDocument();doc.LoadXml(GetListOfPagesInStructureGroup(m_Page.Id));在上面我加载...

我使用C#2.0和我有低于code:

I am using C# 2.0 and I have got below code:

  XmlDocument doc = new XmlDocument();
  doc.LoadXml(GetListOfPagesInStructureGroup(m_Page.Id));

在上面我加载我的XMLDocument与方法,它返回的字符串,现在上面的XmlDocument一些处理之后,我想申请XSLT以上的XMLDocument根据XSLT,最后我的函数会返回整个渲染XML来呈现我想要的结果作为字符串

In above I am loading my XMLDocument with method which returns as string, now after some processing on above xmldocument I want to apply XSLT on the above XMLDocument to render my desired result according to XSLT and finally my function will return whole rendered XML as string

请建议!!

推荐答案

请提出下面的解决方案:

Please suggest on below solution:

        XslCompiledTransform xslTransform = new XslCompiledTransform();
        StringWriter writer = new StringWriter();          
        xslTransform.Load("xslt/RenderDestinationTabXML.xslt");
        xslTransform.Transform(doc.CreateNavigator(),null, writer);
        return writer.ToString();

谢谢!

阅读全文

相关推荐

最新文章