Re: [xsl] Problem with rendering of &#160

Subject: Re: [xsl] Problem with rendering of &#160
From: Julian Reschke <julian.reschke@xxxxxx>
Date: Wed, 14 Apr 2004 09:00:51 +0200
Richard.McMillian@xxxxxxxx wrote:
Thanks for info Tom, however with the change you suggested for the XSL, the
resulting HTML output still has this:
<META http-equiv="Content-Type" content="text/html; charset=UTF-16">

The charset=UTF-16 is not the issue.  It is the content="text/html that
causes the
mal-rendering.  Is there an option to give the microsoft parser not to

What's wrong with that? Except possibly that the encoding *isn't* UTF-16?

to this content value?

function GenOrder(xmlstr, xslfile)
  dim xml, xsl, xslFileName, htmlDoc, tstr
  set xml = Server.CreateObject("MSXML2.FreeThreadedDOMDocument.3.0")
  xml.async = FALSE
  xml.validateOnParse    = FALSE
  xml.resolveExternals   = FALSE
  xml.preserveWhiteSpace = False
   WriteToLog ("GenOrder xmlstr = " & xmlstr)
   WriteToLog ("GenOrder xslfile = " & xslfile)
  if xml.LoadXML(xmlstr) then
    set xsl = Server.CreateObject("MSXML2.FreeThreadedDOMDocument.3.0")
    xsl.async = false
    xslFileName = Server.MapPath(xslfile)
    if xsl.parseError.errorCode <> 0 then
      tstr = "<pre>XML Doc XSL Error" & vbCRLF _
           & "Reason: " & xsl.parseError.reason  & vbCRLF _
           & "Line: "   & xsl.parseError.line    & vbCRLF _
           & "Src: "    & xsl.parseError.srcText & vbCRLF _
           & "</pre>"
      tstr = xml.transformNode(xsl)

Now this is the popular ASP XSLT problem #1. Never ever transform to a string, because you'll use the intended encoding information. Always use transformNodeToObject (for instance writing to the Response object) instead.

end if
end if
set xsl = nothing
set xml = nothing
GenOrder = tstr
end function

Regards, Julian

<green/>bytes GmbH -- -- tel:+492512807760

Current Thread