Altova Mailing List Archives


Re: IXMLDOMDocument::transformNode Unspecified error

From: "Sam Hobbs" <samuel@------.--.---_------_------_--_----->
To: NULL
Date: 9/23/2005 6:44:00 PM
"Martin Honnen" <mahotrash@y...> wrote in message 
news:uYkv%238GwFHA.2312@T......
>
> Guess: you forgot to set async = false before loading the XSLT stylesheet.

I have looked at many samples, all of which "set async = false". My code 
does to; see:

Document->put_async(VARIANT_FALSE);

> Usually neither script nor VB code to use MSXML is long

You got that right.

> if you show us both the VB and the JavaScript version I am rather sure we 
> can find the difference.

My VB code is:

////////////////////////////////////////////////////////////
    Dim XML As New MSXML2.DOMDocument
    Dim XSL As New MSXML2.DOMDocument
XML.async = False
XML.Load Root + "Security.xml"
XSL.async = False
XSL.Load Root + "Security.xsl"
On Error Resume Next
NodeText = XML.transformNode(XSL)
If Err.Number <> 0 Then
    Debug.Print Hex(Err.Number), Err.Description
    MsgBox Err.Description
    Exit Sub
End If
////////////////////////////////////////////////////////////

My JavaScript code is:

////////////////////////////////////////////////////////////
function Transform(From, To) {
// Load XML
var xml = new ActiveXObject("Microsoft.XMLDOM");
xml.async = false;
try {xml.load(From);}
catch(e) {
    return e + " error from xml.load";
    }
// Load the XSL
var xsl = new ActiveXObject("Microsoft.XMLDOM");
xsl.async = false;
try {xsl.load(To);}
catch(e) {
    return e + " error from xsl.load";
    }
// Transform
try {var NodeText = xml.transformNode(xsl);}
catch(e) {
    return e + " error from Transform";
    }
return NodeText;
}

////////////////////////////////////////////////////////////

My XML:

////////////////////////////////////////////////////////////
<Security Date="09/10/2005">
<User><Name>George</Name></User>
<User Type="Administrator"><Name>Debbie</Name></User>
<User><Name>Sam</Name></User>
<User><Name>Dave</Name></User>
<User><Name>Cindy</Name></User>
</Security>

////////////////////////////////////////////////////////////

My XSL:

////////////////////////////////////////////////////////////
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
version="1.0"/>
<xsl:template match="/Security">
  <html>
  <body>
  <!--
    <table border="2" bgcolor="cyan">
      <tr>
        <th>Date</th>
      </tr>
      <xsl:for-each select="Security">
      <tr>
        <td><xsl:value-of select="@Date"/></td>
      </tr>
      </xsl:for-each>
    </table>
    -->
    <table border="2" bgcolor="gray">
      <tr>
        <th>Name</th>
        <th>Type</th>
      </tr>
      <xsl:for-each select="User">
      <tr>
        <td><xsl:value-of select="Name"/></td>
        <td><xsl:value-of select="@Type"/></td>
      </tr>
      </xsl:for-each>
    </table>
  </body>
  </html>
</xsl:template>
</xsl:stylesheet>
////////////////////////////////////////////////////////////


Disclaimer

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.