Hi,
I have following method:
int Transformer::doTransform(const std::string& profileName)
{
XALAN_USING_STD(cerr)
XALAN_USING_STD(endl)
XALAN_USING_XALAN(XalanTransformer)
XALAN_USING_XALAN(XalanDOMString)
int result = -1;
initialize();
// Try to open the output file.
FILE* const outputFile = fopen(fileHandler->GetOutputFilePath().c_str(),
"w");
if( outputFile )
{
CallbackHandler cbHandler(outputFile);
string test("active");
XalanTransformer xalanTransformer;
const XalanDOMString keyActive("active");
const XalanDOMString valActive(profileName.c_str());
xalanTransformer.setStylesheetParam( keyActive, valActive );
result = xalanTransformer.transform(
fileHandler->GetInputFilePath().c_str(),
fileHandler->GetTransformationFilePath().c_str(),
&cbHandler,
writeCallback,
flushCallback );
fclose(outputFile);
if(result != 0)
{
cerr << "XalanError: " << xalanTransformer.getLastError() << endl;
}
}
else
{
cerr << "Error: " << "Unable to open output file " <<
fileHandler->GetOutputFilePath().c_str() << endl;
}
finalize();
return result;
}
The "active" parameter never gets proper value!
I'm wondering how the const XalanDOMString valActive(profileName.c_str());
should be initialized?
If I change the const XalanDOMString valActive(profileName.c_str()); to
const XalanDOMString valActive("'MyTestProfile'");, it works fine. But in my
case I'll need a std::string variable. I'm beginner in using Xerces and Xalan so could
someone more experienced in this area help me futher?
Thanks,
Harry