Harry Liljeström wrote:
Hi,

I have following method:


...



The "active" parameter never gets proper value!


Well, I guess that depends on what you want the proper value to be.

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?

The expression parameter of XalanTransformer::setStylesheetParam() is an XPath expression, so the string "active" is interpreted as a location path. If you want a string literal, you need to delimit it with single or double quotes:

std::string localProfile("'");
localProfile += profileName;
localProfile += "'";

Note that there is an overload of setStylesheetParam() that accepts const char*, so you do not necessarily need to create XalanDOMString instances to set the params:

std::string keyActive("active");

xalanTransformer.setStylesheetParam( keyActive.c_str(), localProfile.c_str() );

Dave

Reply via email to