[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] MSXML3 transformNodeToObject method error


Subject: [xsl] MSXML3 transformNodeToObject method error
From: Brook Ellingwood <brook@xxxxxxxxxxx>
Date: Tue, 19 Aug 2003 15:41:20 -0700

Hi

I'm having some issues with getting the &#160; character in my XSL to render
in IE for Windows (though, oddly enough, it's working on Mac OS 9!). I could
probably do some sort of cheap escaping trick, but I really want to just be
able to pass the the encoded characters through MSXML untouched. It looks to
me like transformNodeToObject is the way to achieve this.

I've tried cobbling together script on my own without getting it to work,
then I pulled this example from MSDN (I added Response.ContentType and
Response.Charset):


    <%@LANGUAGE="JScript"%>

    <%

      Response.ContentType = "text/HTML"
      Response.Charset= "UTF-8"

      // Load data.
      var source = new ActiveXObject("Msxml2.DOMDocument");
      source.async = false;
      source.resolveExternals = false;
      source.load("test.xml");

      // Load style sheet.
      var stylesheet = new ActiveXObject("Msxml2.DOMDocument");
      stylesheet.async = false;
      stylesheet.resolveExternals = false;
      stylesheet.load("test.xsl");

      // Set up the resulting document.
      var result = new ActiveXObject("Msxml2.DOMDocument");
      result.async = false;
      result.validateOnParse = true;

      // Parse results into a result DOM Document.
     source.transformNodeToObject(stylesheet, result);
  
  %>

When I run it, I get this error:

    The stylesheet does not contain a document element. The stylesheet may
be empty, or it may not be a well-formed XML document.

Well, the stylesheet is fine. Just to be sure, I've stripped it down to
this:

    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="html" encoding="UTF-8" indent="yes"/>

    <xsl:template match="/">
        <HTML>
            <HEAD>
            </HEAD>
            <BODY>
                <xsl:value-of select="./foo" />
            </BODY>
        </HTML>
    </xsl:template>
    </xsl:stylesheet>

The way things are going, I'll probably just hit another error once I get
this one resolved, but does anybody know what's going on here?

Source URL for MS code:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/xmlsdk30/ht
m/xmmthtransformnodetoobject.asp

Thanks,

-- Brook


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



Current Thread
Keywords