public ActionResult GenerateHTMLFromXML(String xml) { xml = xml.Replace("REPORT", "report"); xml = xml.Replace("FULLNAME", "fullname"); xml = xml.Replace("SHORTNAME", "shortname"); xml = xml.Replace("UNP", "unp"); xml = xml.Replace("COUNTRY", "country"); xml = xml.Replace("REGION", "region"); xml = xml.Replace("LOCALITY", "locality"); xml = xml.Replace("ADDRESS", "address"); xml = xml.Replace("SUPREME", "supreme"); xml = xml.Replace("DIRECTOR", "director"); xml = xml.Replace("POST", "post"); xml = xml.Replace("FAX", "fax"); xml = xml.Replace("EMAIL", "email"); xml = xml.Replace("SITE", "site"); xml = xml.Replace("ACCOUNTNUMBER", "accountnumber"); xml = xml.Replace("BANKNAME", "bankname"); xml = xml.Replace("BANKCODE", "bankCode"); xml = xml.Replace("BANKADDRESS", "bankAddress"); xml = xml.Replace("DATE", "date"); string headerXml = @"<?xml version=""1.0"" encoding=""UTF-8""?><root xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xsi:noNamespaceSchemaLocation=""statement.xsd"">"; string footerXml = "</root>"; xml = headerXml + xml + footerXml; string strExamplesFolder = Server.MapPath("~"); // Create a new AltovaXML instance and access its engines Altova.AltovaXML.Application AltovaXML = new Altova.AltovaXML.Application(); // Use XSLT2 Engine of AltovaXML to transform simple.xml using CopyInputXSLT2.xsl Altova.AltovaXML.IXSLT2 AltovaXMLXSLT2 = AltovaXML.XSLT2; AltovaXMLXSLT2.InputXMLFromText = xml; AltovaXMLXSLT2.XSLFileName = strExamplesFolder + "/Content/static/statement_html.xslt"; string s = AltovaXMLXSLT2.ExecuteAndGetResultAsString(); return Json(s); }
public ActionResult GenerateRTFFromXML(String xml) { xml = xml.Replace("REPORTTITLE", "reporttitle"); xml = xml.Replace("ROW", "row"); xml = xml.Replace("REPORT", "report"); xml = xml.Replace("PRESECTION", "presection"); xml = xml.Replace("LOTSTITLE", "lotstitle"); xml = xml.Replace("LOTSSECTION", "lotssection"); xml = xml.Replace("CUSTOMERTITLE", "customertitle"); xml = xml.Replace("CUSTOMERSECTION", "customersection"); xml = xml.Replace("CONTACTSTITLE", "contactstitle"); xml = xml.Replace("CONTACTSSECTION", "contactssection"); xml = xml.Replace("AUCTIONSECTION", "auctionsection"); xml = xml.Replace("AUCTIONTITLE", "auctiontitle"); string headerXml=@"<?xml version=""1.0"" encoding=""UTF-8""?><root xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xsi:noNamespaceSchemaLocation=""report.xsd"">"; string footerXml = "</root>"; xml = headerXml + xml+footerXml; string strExamplesFolder = Server.MapPath("~"); // Create a new AltovaXML instance and access its engines Altova.AltovaXML.Application AltovaXML = new Altova.AltovaXML.Application(); // Use XSLT2 Engine of AltovaXML to transform simple.xml using CopyInputXSLT2.xsl Altova.AltovaXML.IXSLT2 AltovaXMLXSLT2 = AltovaXML.XSLT2; //AltovaXMLXSLT2.InputXMLFileName = strExamplesFolder + "report.xml"; AltovaXMLXSLT2.InputXMLFromText = xml; AltovaXMLXSLT2.XSLFileName = strExamplesFolder + "/Content/static/rtf.xslt"; //AltovaXMLXSLT2.Execute(strExamplesFolder + "report.rtf"); return Json(AltovaXMLXSLT2.ExecuteAndGetResultAsString()); }