xsl-list
[Top] [All Lists]

Re: Problem with rendering of &#160

2004-04-14 00:00:51
Richard(_dot_)McMillian(_at_)cexp(_dot_)com 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?

default
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)
    xsl.load(xslFileName)
    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>"
    else
      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 -- http://www.greenbytes.de -- tel:+492512807760


<Prev in Thread] Current Thread [Next in Thread>