title: C++ XLST transform not working using MSXML 3.0
body: <p>I'm new to C++ and inherited the following code that is supposed to transform the given XML using the XSLT file to just spit out the text values.</p>
  
  <p>It loads both the XML and XSLT fine and the transformnode() call returns success but no transformation has been applied. The original output at the bottom contains the original XML intact .</p>
  
  <p>It is using MSXML 3.0. I've used Xselerator to validate that the XSLT is valid and works (i.e. the string "This is a test message.." is returned). </p>
  
  <p>Here is the code (minus all the error handling):</p>
  
  <pre><code>IXMLDOMNode *m_pXslt;
  
  ESSXsltData::Initialise(void)
  {
      IUnknown *l_pUnknown = NULL;
      IXMLDOMDocument *l_pXSLDocument = NULL;
  
  HRESULT hr = CoCreateInstance(__uuidof(DOMDocument), NULL, CLSCTX_ALL, IID_IUnknown, (LPVOID *)&amp;l_pUnknown);
  hr = l_pUnknown-&gt;QueryInterface(IID_IXMLDOMDocument,(LPVOID *)&amp;l_pXSLDocument);
  CString l_sFileName(RetrieveXsltFileName().c_str() );
  hr = l_pXSLDocument-&gt;load(l_vFileName, &amp;l_bSuccess);
  
  hr = l_pXSLDocument-&gt;QueryInterface(IID_IXMLDOMNode, (LPVOID *)(&amp;m_pXslt) );
  }
  
  HRESULT ESSXsltData::ApplyXslt(const char *p_pszESSXml, std::vector&lt; std::string &gt; &amp;p_CommentLines)
  {
      IUnknown *l_pUnknown = NULL;
      IXMLDOMDocument *l_pDocument = NULL;
  
  
  if (p_pszESSXml)
  {
      VARIANT_BOOL l_bSuccess;
      HRESULT hr = CoCreateInstance(__uuidof(DOMDocument), NULL, CLSCTX_ALL, IID_IUnknown, (LPVOID *)&amp;l_pUnknown);
      hr = l_pUnknown-&gt;QueryInterface(IID_IXMLDOMDocument,(LPVOID *)&amp;l_pDocument);
  
      hr = l_pDocument-&gt;loadXML(CComBSTR(p_pszESSXml) , &amp;l_bSuccess);
      hr = l_pDocument-&gt;QueryInterface(IID_IXMLDOMNode, (LPVOID *)(&amp;m_pXslt) );
  
      BSTR l_bsOutput = NULL;
      hr = l_pDocument-&gt;transformNode(m_pXslt, &amp;l_bsOutput);
  
      COLE2T l_AsciiOutput(l_bsOutput);
      log &lt;&lt; "AsciiOutput: " &lt;&lt; l_AsciiOutput &lt;&lt; "\n"; 
  }
  }
  </code></pre>
  
  <p>The p_pszESSXml string is:</p>
  
  <pre><code>&lt;ESS&gt;&lt;Message&gt;This is a test message...&lt;/Message&gt;&lt;/ESS&gt;
  </code></pre>
  
  <p>The XSLT is:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"&gt;
      &lt;xsl:output method="text" indent="yes"/&gt;
      &lt;xsl:template match="ESS"&gt;
          &lt;xsl:apply-templates select="Message"/&gt;
      &lt;/xsl:template&gt;
      &lt;xsl:template match="Message"&gt;
          &lt;xsl:value-of select="."/&gt;
      &lt;/xsl:template&gt;
  &lt;/xsl:stylesheet&gt;
  </code></pre>