using System.Xml;
using System.Xml.XPath;
using System.Xml.Xsl;

namespace XmlToHtml
{
    public static class XmlTransformer
    {
        public static void Transform(string xmlPath, string outputPath)
        {
            var xmlDoc = new XPathDocument(xmlPath);
            var xslTrans = new XslCompiledTransform();
            var xmlResolver = new XmlUrlResolver();

            // Load the transformation from resources
            var programType = typeof(Program);

                string file = @"UITestBin\NUnitXslTransform.xslt";
                using (var xmlReader = XmlReader.Create(file))
                {
                    xslTrans.Load(xmlReader, new XsltSettings {EnableDocumentFunction = true}, xmlResolver);
                }
            

            using (var writer = new XmlTextWriter(outputPath, null))
            {
                xslTrans.Transform(xmlDoc, writer);
            }
        }
    }
}


