From: Friedel Jantzen on
Hi,
how can I retrieve the messages (xsl:message) from a xslt script using
MSXML3 DOM with smart pointers in C++?

On MSDN there is a sample how to do this with C#.
They add an event handler with the address of a callback function to an
argument list and pass the arglist as a parameter to Transform():
// Create the XslCompiledTransform object and load the style sheet.
XslCompiledTransform xslt = new XslCompiledTransform();
xslt.Load("message.xsl");
XsltArgumentList argList = new XsltArgumentList();
argList.XsltMessageEncountered += new
XsltMessageEncounteredEventHandler(MessageCallBack);
// Load the file to transform.
XPathDocument doc = new XPathDocument("books.xml");
// Transform the file.
xslt.Transform(doc, argList, XmlWriter.Create("output.xml"));

Here are a few lines from my C++ code:

MSXML2::IXSLTemplatePtr pTemplate(CLSID_XSLTemplate);
// ...
MSXML2::IXSLProcessorPtr pProcessor = pTemplate->createProcessor();
// ...
pProcessor->put_output(_variant_t(pOutStream));
// ...
pProcessor->put_input(_variant_t((IUnknown*)pXml));
pProcessor->transform();

Afaik IXSLProcessorPtr->transform() has no parameters.
I can pass parameters with pProcessor->addParameter(....),
but how can I create a XsltMessageEncounteredEventHandler(MessageCallBack)
using smart pointers and pass it to the transformer?
Or is there another way doing this?

Any hints are welcome.
TIA,
Friedel