Quantcast
Channel: XML, System.Xml, MSXML and XmlLite forum
Viewing all articles
Browse latest Browse all 935

XSLT transform takes lots of time in console application(more than 5 minutes) than WCF service(15 seconds)

$
0
0

Hi

In console application when we are trying to transform XSLT , its taking lots of times to translate.<o:p></o:p>

transform.Transform(xmlReader,outputXmlWriter);

Code given below:::

protected string GetTransformedXml(string inputFileNameXSLT, object viewModelPart)
        {
            StringBuilder sb = new StringBuilder();
            XmlWriterSettings settings = new XmlWriterSettings { ConformanceLevel = ConformanceLevel.Fragment, OmitXmlDeclaration = true };
            XmlWriter outputXmlWriter = XmlWriter.Create(sb, settings);
            XslCompiledTransform transform = new XslCompiledTransform();
            transform.Load(inputFileNameXSLT);
            using (MemoryStream ms = SerializeToStream(viewModelPart))
            {
                ms.Seek(0, SeekOrigin.Begin);
                XmlReader xmlReader = XmlReader.Create(ms);
                transform.Transform(xmlReader, outputXmlWriter);

            }
            return sb.ToString();
        }

private MemoryStream SerializeToStream(object obj)
        {
            XmlSerializer serializer = new XmlSerializer(obj.GetType());
            MemoryStream ms = new MemoryStream();
            serializer.Serialize(ms, obj);
            return ms;
        }

inputFileNameXSLT(XSLT):::Size 3736KB


Viewing all articles
Browse latest Browse all 935

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>