xsl-list
[Top] [All Lists]

Re: output encoding problem (can't get UTF-8)

2005-08-05 11:28:36

----- Original Message ----- From: "Gabriel K" <gabriel(_dot_)klappenbach(_at_)bredband(_dot_)net>
To: <xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>
Sent: Friday, August 05, 2005 6:15 PM
Subject: SV: [xsl] output encoding problem (can't get UTF-8)


The ASP file is:
http://gabbah.no-ip.org/mirakel/default.asp.txt

I sometimes read the XML file from disk statically, but most of the time it
comes from a COM-object.

Basically it's:

set o = Server.CreateObject("MwebbCOM.MwebbCOM.1")
domXML.loadXML(o.Document)

And that's the XML file you get, the one I reffered to below.

/Gabriel

Well this asp page

<% @Language="JavaScript" %>
<%

var URL = "http://gabbah.no-ip.org/mirakel/default.asp?ctype=STP&cdoc=object&cnMaxRows=10&cnBookmark=H2856&cpKNP=*&transform=no";;
 var XSLT = "simple.xslt";

 function getSyncDom()
 {
   var oDom = new ActiveXObject("Msxml2.FreeThreadedDomDocument.4.0");
   oDom.async = false;
   return oDom;
 }

 function getServerHttpRequest()
 {
   return new ActiveXObject("Msxml2.ServerXmlHttp.4.0");
 }

 function getXslTemplate()
 {
   return new ActiveXObject("Msxml2.XSLTemplate.4.0");
 }

 function main()
 {
   var oHttpReq = getServerHttpRequest();
   oHttpReq.open("GET", URL, false);
   oHttpReq.send();
   //Response.ContentType = "text/xml";
   var oXslt = getSyncDom();
   oXslt.load(Server.MapPath("simple.xsl"));
   var oTemplate = getXslTemplate();
   oTemplate.stylesheet = oXslt;
   var oProc = oTemplate.createProcessor();
   oProc.input = oHttpReq.responseXML;
   oProc.output = Response;
   oProc.transform();
 }

 main();

%>

with this stylesheet:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; xmlns:ns="http://www.mirakel.nu/xml";
 version="1.0">
<xsl:output method="html" media-type="text/html" encoding="UTF-8" indent="no" omit-xml-declaration="yes" doctype-public="-//W3C//DTD HTML 4.01//EN" doctype-system="http://www.w3.org/TR/html4/strict.dtd"; />
 <xsl:template match="/">
   <html>
     <head>
       <title>Simple Transform</title>
     </head>
     <body>
       <xsl:value-of select="*/ns:MARKdescr" />
     </body>
   </html>
 </xsl:template>
</xsl:stylesheet>

shows the characters correctly. I have IE 6 set to auto-select.

--

Joe

--~------------------------------------------------------------------
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>
--~--