Transform XML into HTML using XSLT in C#.NET



Transform XML into HTML using XSLT in C#.NET

using System.Xml.Xsl;
using System.Xml;
using System.Xml.Xpath;
using System.IO;

public static string ConvertXML(XmlDocument InputXMLDocument, string XSLTFilePath
 , XsltArgumentList XSLTArgs)
        {
            StringWriter sw = new System.IO.StringWriter();
            XslCompiledTransform xslTrans = new XslCompiledTransform();
           //Loads the xml from path to transform
            xslTrans.Load(XSLTFilePath);
          //Transforms xml to HTML
            xslTrans.Transform(InputXMLDocument.CreateNavigator(), XSLTArgs, sw);
            return sw.ToString();
        }

Share |

 Cant find the page you are looking for?
 Help us to improve by adding the content that you are looking for.
 Leave a feedback
 We look forward to hear your comments and feedback.