XSLT compile error for using MemoryStream

Ragеreuas

New Member
I am creating an xslt and xml file dynamically to show my questionnaire & save my question options (for dropdown). Now I want to use stream instead of writing on actual file. So this is how I am doing it:\[code\]XmlReader xslt_reader;XmlReader xml_reader;PageLoad(){ Fn_CreateXSL(); Fn_CreateXML(); LoadQuestionnaire();}Fn_CreateXSL(){ xslt_stream = new MemoryStream(); XmlTextWriter objXSLTWriter = new XmlTextWriter(xslt_stream, Encoding.UTF8); objXSLTWriter.Formatting = Formatting.Indented; objXSLTWriter.WriteStartDocument(); .......... objXSLTWriter.WriteEndDocument(); xslt_stream.Seek(0, SeekOrigin.Begin); xslt_reader = XmlReader.Create(xslt_stream);}Fn_CreateXML(){ xmlt_stream = new MemoryStream(); XmlTextWriter objXMLTWriter = new XmlTextWriter(xmlt_stream, Encoding.UTF8); objXMLTWriter.Formatting = Formatting.Indented; objXMLTWriter.WriteStartDocument(); .......... objXMLTWriter.WriteEndDocument(); xmlt_stream.Seek(0, SeekOrigin.Begin); xmlt_reader = XmlReader.Create(xmlt_stream);}LoadQuestionnaire(){ XslCompiledTransform var_xsl_trans = new XslCompiledTransform(); // also tried var_xsl_trans.Load(xslt_reader, null, new XmlUrlResolver()); var_xsl_trans.Load(xslt_reader); // XSLT Compile Error occurs StringWriter sw = new StringWriter(); var_xsl_trans.Transform(xml_reader, null, sw);}\[/code\]But I am getting "XSLT Compile Error when I'm trying to load it. Any idea?
 
Back
Top