Well here's the funny thing.
I can skip using the stream altogether if I want.
I can use
domXML.loadXML( o.document )
So I load the XML directly from the COM object into a DOM XML object. So
there's really no need for the stream. But the result is the same.
So, the code will look like this if I skip using the stream:
<% @LANGUAGE="VBSCRIPT" %>
<%
option explicit
Response.Expires=-1
'Response.ContentType = "text/html"
' setup XML-server
------------------------------------------------------------------
dim o
set o = Server.CreateObject("MwebbCOM.MwebbCOM.1")
o.httpRemoteUser = Request.ServerVariables("REMOTE_USER")
o.httpRemoteAddr = Request.ServerVariables("REMOTE_ADDR")
o.httpQueryString = Request.QueryString
o.BeginTransaction
' load XML and XSL ---------------------------------------------------
dim domXML, domXSL, processor, template
set domXSL = Server.createObject("MSXML2.FreeThreadedDOMDocument.5.0")
set domXML = Server.createObject("MSXML2.DOMDocument.5.0")
domXSL.load(Server.MapPath("XSL/PC/PC-templates.xsl"))
domXML.loadXML(o.document)
' output with IXSLProcessor ------------------------------------------
Set template = Server.CreateObject("MSXML2.XSLTemplate.5.0")
template.stylesheet = domXSL
set processor = template.createProcessor()
processor.input = domXML
processor.output = Response
processor.transform()
%>
So how come the processor still ignores the encoding specified in the XML?
/Gabriel
-----Ursprungligt meddelande-----
Från: andrew welch [mailto:andrew(_dot_)j(_dot_)welch(_at_)gmail(_dot_)com]
Skickat: den 13 september 2005 17:52
Till: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Ämne: Re: [xsl] IXSLProcessor - input in UTF-8?
On 9/13/05, Gabriel <gabriel(_dot_)klappenbach(_at_)gmail(_dot_)com> wrote:
I get the XML from a COM-object that I use in an ASP page:
<% @LANGUAGE="VBSCRIPT" %>
<%
option explicit
Response.Expires=-1
'Response.ContentType = "text/html"
' setup XML-server
------------------------------------------------------------------
dim o
set o = Server.CreateObject("MwebbCOM.MwebbCOM.1")
o.httpRemoteUser = Request.ServerVariables("REMOTE_USER")
o.httpRemoteAddr = Request.ServerVariables("REMOTE_ADDR")
o.httpQueryString = Request.QueryString
o.BeginTransaction
' --------------------------------------------------------------------
' setup ADODB Stream -------------------------------------------------
dim oStream
set oStream = createobject("Adodb.Stream")
oStream.Type = 2
oStream.Charset = "UTF-8"
oStream.open
oStream.writeText o.document
oStream.position = 0
' load XML and XSL ---------------------------------------------------
dim domXML, domXSL, processor, template
set domXSL = Server.createObject("MSXML2.FreeThreadedDOMDocument.5.0")
set domXML = Server.createObject("MSXML2.DOMDocument.5.0")
domXSL.load(Server.MapPath("XSL/PC/PC-templates.xsl"))
domXML.load(oStream)
' output with IXSLProcessor ------------------------------------------
Set template = Server.CreateObject("MSXML2.XSLTemplate.5.0")
template.stylesheet = domXSL
set processor = template.createProcessor()
processor.input = domXML
processor.output = Response
processor.transform()
%>
As you can see I put the XML in a stream and then load it into a DOM XML
object. This serves as input to IXSLProcessor.
The xml has the declaration <?xml version="1.0" encoding="UTF-8"?>
What could be non XML aware in my code?
I would think the way you are using the stream, but I don't know VB so
I can't suggest anything other than investigate a different approach
there.
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail:
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--