private void ConvertXMLToHTML(string xmfile)
{
//string xmlPath = HttpContext.Current.Server.MapPath(xmfile);
try
{
string XSLpath = System.Configuration.ConfigurationSettings.AppSettings.Get("XSLFile").ToString();
string originalhtmlpath = System.Configuration.ConfigurationSettings.AppSettings.Get("HTMLFile").ToString();
StringBuilder strb = new StringBuilder();
//+ "/" + System.Configuration.ConfigurationSettings.AppSettings.Get("ConfigFile").ToString());
string xsltpath = VirtualPathUtility.ToAbsolute("/PdfProject/BlGeneratePdf/BlGeneratePdf/NBS.xslt");
theText1 = this.GetXSLT(xsltpath, "");
// string xslPath = HttpContext.Current.Server.MapPath("NBS.xslt");
//Instantiate the XPathDocument Class
XmlDocument doc = new XmlDocument();
doc.LoadXml(xmfile);
////Instantiate the XslTransform Class
// XslTransform transform = new XslTransform();
// // transform.Load("NBS.xslt");
// transform.Load(XSLpath);
// XmlTextWriter writer = new XmlTextWriter(originalhtmlpath,null);
// writer.Formatting = Formatting.Indented;
// writer.Indentation=4;
// transform.Transform(doc, null, writer);
XslTransform xslt = new XslTransform();
xslt.Load(XSLpath);
XmlTextWriter writer = new XmlTextWriter(originalhtmlpath, null);
xslt.Transform(doc, null, writer);
writer.Close();
}
catch (Exception ex)
{
throw;
}
}
Subscribe to:
Post Comments (Atom)

No comments:
Post a Comment