S
shapper
Hello,
I am using a XSL file to transform a XML file.
Then I want to display the XML file in browser as XML type.
I am working on an Asp.Net 2.0 HTTP Generic Handler (.ashx).
My code is:
Public Sub ProcessRequest(ByVal context As HttpContext) Implements
IHttpHandler.ProcessRequest
Dim server As System.Web.HttpServerUtility =
System.Web.HttpContext.Current.Server
Dim docXml As XmlDocument = New XmlDocument
docXml.Load(server.MapPath("~/App_Data/Doc.Xml"))
Dim docXsl As XslCompiledTransform = New XslCompiledTransform
docXsl.Load(server.MapPath("~/App_Data/Doc.xsl"))
docXsl.Transform(docXml, Nothing,
HttpContext.Current.Response.Output)
' context.Response.ContentType = "text/xml"
' ??? context.Response.Write(...)
End Sub
I need to display the XML file in my browser as XML file.
With docXsl.Transform(docXml, Nothing,
HttpContext.Current.Response.Output) I am not doing it.
Is there an option to make this hapening?
Maybe if I save the result in a XML object and then place it in
context.Response.Write(...).
I think this would be the best option.
Could someone help me out?
Thanks,
Miguel
I am using a XSL file to transform a XML file.
Then I want to display the XML file in browser as XML type.
I am working on an Asp.Net 2.0 HTTP Generic Handler (.ashx).
My code is:
Public Sub ProcessRequest(ByVal context As HttpContext) Implements
IHttpHandler.ProcessRequest
Dim server As System.Web.HttpServerUtility =
System.Web.HttpContext.Current.Server
Dim docXml As XmlDocument = New XmlDocument
docXml.Load(server.MapPath("~/App_Data/Doc.Xml"))
Dim docXsl As XslCompiledTransform = New XslCompiledTransform
docXsl.Load(server.MapPath("~/App_Data/Doc.xsl"))
docXsl.Transform(docXml, Nothing,
HttpContext.Current.Response.Output)
' context.Response.ContentType = "text/xml"
' ??? context.Response.Write(...)
End Sub
I need to display the XML file in my browser as XML file.
With docXsl.Transform(docXml, Nothing,
HttpContext.Current.Response.Output) I am not doing it.
Is there an option to make this hapening?
Maybe if I save the result in a XML object and then place it in
context.Response.Write(...).
I think this would be the best option.
Could someone help me out?
Thanks,
Miguel