I am playing with XSLT with MSXML2 for the first time. And of course it doesn't work :-)开发者_StackOverflow社区 I have a bug which I cannot figure to solve.
So as to fix the bug, I try to understand everything around: and something shocks me.
void xsltProcessing(IXMLDOMDocument* pXmlDoc, IXMLDOMDocument * pXslDoc)
{
CComPtr<IXSLTemplate> pTemplate;
pTemplate.CoCreateInstance(CLSID_XSLTemplate);
pTemplate->putref_stylesheet(pXslDoc);
//...
}
it compiles like a breeze whereas this is the definition of putref_stylesheet
virtual HRESULT __stdcall putref_stylesheet (
/*[in]*/ struct IXMLDOMNode * stylesheet ) = 0;
and I haven't found any definition that would accept a IXMLDOMDocument * as a parameter.
How is that possible to compile ? the two types simply don't match !
any help appreciated.
I have found these two links that also pass xmldocuments in their code !: Example One Example Two
IXMLDOMDocument
is derived from IXMLDOMNode
according to MSDN. Hence it is same as passing a derived class pointer to a class expecting a base class pointer. Hence it compiles.
精彩评论