Tim Hastings - NonHostile (because there's no need)

Weblog and collection of geeky articles.

  Home :: Who? :: Contact :: Links :: Subscribe subscribe
Abigail, 13 weeks old tomorrowDig Dig DigAbigail's Christening


From time to time, my web host changes some aspect of the server that this weblog is hosted on. The code that runs this site is written in classic ASP which means it is hosted on IIS. Recently another configuration change took place, presumably one of Microsoft's many hot fixes or an upgrade to a new version of Windows or IIS.

The following error started to appear tagged onto the bottom of every web page:

    msxml3.dll error '80004001'
    Not implemented

Behind the scenes, this site use XML and XSL to separate the site's data from its layout, in the middle somewhere is a line of code which performs an XSLT transformation on the XML DOM into the HTML output which gets squirted out into the response.

    ' method to transform the response (with errors)
    public sub TransformToResponse_Old(xml, xsl)
        xml.transformNodeToObject xsl, Response
    end sub

Somewhere in the depths of ASP or IIS, a change has occurred which has dropped the IStream support of the classic ASP response object (I presume looking at the symptoms).

The fix introduces an intermediate stream to receive the XSLT transformation, and then send that to the response. This method also sets the response code page to be UTF8, which this site uses.

    ' method to transform the response (without errors)
    public sub TransformToResponse_New(xml, xsl)

        ' By Tim Hastings, www.nonhostile.com
        ' prepare stream to receive transformation
        dim outputStream
        Set outputStream = Server.CreateObject("ADODB.Stream")
        outputStream.Open 
        outputStream.Charset = "UTF-8"
        outputStream.Type = 1 ' adTypeBinary

        ' transform and output to stream
        xml.transformNodeToObject xsl, outputStream
        
        ' set character-set
        Response.CharSet = "UTF-8"
        Response.ContentType = "text/html"        
        Session.CodePage = 65001
        
        ' rewind the stream and send to response
        outputStream.Position = 0
        Response.BinaryWrite outputStream.Read()
                                
        ' finished with the stream
        outputStream.Close
        set outputStream = Nothing

    end sub

Hope this helps!




9 comments, Web, Tuesday, December 16, 2008 11:53

Timeline Navigation for Web posts
ASP Fix: XML transformNodeToObject - Not implemented (80004001) (this post, made Tuesday, December 16, 2008 11:53)
Privacy Risk With Internet Explorer (made 145 weeks earlier)


Comments
Nice catch and great workaround!

Posted by: Samuel on Wednesday, December 24, 2008 10:04
Thanks for the workaround.

This problem appeared after a recent windows update (KB955069). It looks like there were changes made to msxml3.dll which caused this issue.

http://support.microsoft.com/kb/955069

-Windows 2000 SP4
-MSXML 3.0 SP10 (msxml3.dll v8.100.1048.0 08-Sep-2008)
-IIS v5.0 (asp.dll v5.0.2195.7084 11-Apr-2006)

Posted by: John on Thursday, January 8, 2009 00:16
Nice to see someone else using this technique for generating HTML.

Is there an advantage to using the stream? I've just looked at my library and I appear to spew it out directly from the transformation:

response.write xmlObj.transformNode( xsl )

Posted by: Yoted on Thursday, January 15, 2009 21:15
Thanks for your code! Life saver!

Posted by: Alex on Monday, January 19, 2009 01:35
This really got me out of a hole. A course that I present, and have presented for many years without issue, failed because of this problem.
Your solution worked beautifully.
Kudos to you!

Posted by: Ian Thwaites on Thursday, February 5, 2009 03:28
Thanks a lot man, that's works wonderfully.

Posted by: Eric Gaspard on Friday, March 13, 2009 16:31
i love you man!!! thanx so much!!!!!!

Posted by: Ozzie on Friday, March 13, 2009 19:07
Perfect! First result on a google search of the problem. Nice work.

Posted by: dion on Wednesday, July 8, 2009 17:58
Worked like a charm, thanks!
I don't understand though, why transformNode() doesn't work in the first place.
I have to use transformNodeToObject because transformNode insists that the html is in UTF-16 (which is not true).
I'm wondering if there's a proper way to do this.

I mean, applying xsl on xml should be pretty straightforward (even if it's server-side). After all, that what xsl is for.

Posted by: Ariel on Tuesday, June 15, 2010 08:40

Post a Comment
Name:  Home page and email address are optional.
  Email addresses will not be displayed or spammed!
Remember these details
Email:
Home Page:
Comment:
Comments cannot contain HTML, URLs will be formatted into hyperlinks.
I reserve the right to remove any comments for any reason.