title: MSXML: How do ask an IXMLDOMNode what version MSXML it comes from?
body: <p>How can i ask what version of MSXML an <strong>IXMLDOMDocument2</strong> is? Given an <strong>IXMLDOMDocument2</strong> i need to create another document of the same version.</p>
  
  <p>If you give an IXMLDOMDocument from different versions of MSXML, you will get an exception from msxml:</p>
  
  <blockquote>
    <p>It is an error to mix objects from different versions of MSXML.</p>
  </blockquote>
  
  <p>Microsoft internally can ask an interface what version of MSXML it came from, i need access to the same thing.</p>
  
  <hr>
  
  <p>Consider the following hypothetical function written in pseudo-code:</p>
  
  <pre><code>String XMLTransform(IXMLDOMNode xml, String xsl)
  {
      //Create a document to hold the xml
      IXMLDOMDocument2 xslDocument = new CoDOMDocument();
  
      //load the xsl string into the xsl dom document
      xslDocument.loadXML(xsl);
  
      //transform the xml
      return xml.transformNode(xslDocument);     
  }
  </code></pre>
  
  <p>Problem is that if IXMLDOMNode comes from, say <strong>MSXML6</strong>. The created <code>DOMDocument</code> is from version 3 (because of Microsoft's version dependance in MSXML). This will cause the</p>
  
  <pre><code>xml.transformNode()
  </code></pre>
  
  <p>to throw a COM exception:</p>
  
  <pre><code>It is an error to mix objects from different versions of MSXML.
  </code></pre>
  
  <p>Since Microsoft is able to ask an interface what version of MSXML it came from, i should be able to do the same thing, but how?</p>
  
  <p>Alternativly, given an <code>IXMLDOMNode</code>, how can i construct an <code>XMLDOMDocument</code> object of the same version...</p>