ASP.net Transfrom Memory XML and send output to client.

Skyruner2

n00b
Joined
Mar 13, 2005
Messages
10
So i am loading a base XML file. Modify this file in the memory, load an xsl that should convert it to a nice HTML page.

however, i have no clue as to how i can send the transfrom results to the client!

here is what im doing:

Code:
//the classes
    public abstract class XMLWorker
    {
        protected XmlDocument xmlDoc = new XmlDocument();

        protected XMLWorker()
        {
        }
    }
    public sealed class XMLPageCore : XMLWorker
    {
        public XMLPageCore(string Path2BaseXML)
        {
            xmlDoc.Load(Path2BaseXML);
            XmlElement selectedNode = (XmlElement)xmlDoc.DocumentElement.SelectSingleNode("General/Now");
        }
        public void Deploy(string XSLTPath,System.IO.Stream Stream)
        {
            System.Xml.Xsl.XslCompiledTransform XSLT = new System.Xml.Xsl.XslCompiledTransform();
            default: XSLT.Load(XSLTPath);
            System.Xml.Xsl.XsltArgumentList args=new System.Xml.Xsl.XsltArgumentList ();
            XSLT.Transform(xmlDoc.DocumentElement,args,Stream);
        }
    }
   
//The call

    XMLPageCore test = new XMLPageCore(Server.MapPath("test/XMLFile.xml"));
    test.Deploy(false,Server.MapPath("test/XSLTFile.xsl"),Response.OutputStream);



on the page though, i get the XML Processing Instructions <?.. and then all of the xml content w/o any tags or whitespace.

but if i use the overload of xslt.transform that will take the input and output files as parameter, it works just fine.

to be honest im really at a bit of a loss as to what is going on here!
 
I'm working on some ASP.NET XML this weekend. I'll try to find an answer for you too.
 
Back
Top