Hi!
Seems that I've found the reason of the problem and it looks like a bug in my 
own code ;-)))
The bad thing is that this code compiles and works without any problems with 
the previous versions of Xalan, gcc-2.96 or Sun Workshop 6.0.
Probably the bug was triggered by update to gcc-3.2 or Xalan-1.4.

Here is the code example:
....
    std::ostringstream resultStream;
    XSLTResultTarget result(resultStream);

    transformer.transform(*parsedXML, bodyXSL, result);
    bodyStr = resultStream.str().c_str();

    resultStream.seekp(0);

    transformer.transform(*parsedXML, dateXSL, result);
    dateStr = resultStream.str().c_str();
....


Seems that in the old setup calling "resultStream.seekp(0);" was cleaning the 
stream and setting write position to zero (or Xalan was writing '\0' to the 
stream at the end of the transformation result), not it is only setting 
position. So, in my case, result of the first transformation will be correct, 
of the second (and all subsequent) will contain trailing garbage from the 
first transformation.
To achieve the same behaviour as before I've changed:

resultStream.seekp(0);

to:

resultStream.seekp(0);
resultStream.str("");

In this case it works as expected.

        Alexei

Reply via email to