Defining the XSLT Transformation Output Stream
Define the output stream in the same way.
This code can be found in buildspace\examples\xmlstreams\xsltTransform\RWXsltObjectOutputStreamImp.h.
 
class RWXsltObjectOutputStreamImp : public RWXmlObjectOutputStreamImp
{
protected:
 
RWXsltObjectOutputStreamImp(std::ostream& ostr,
RWTXsltTransform<char> transformer,
const RWCString& rootElementType,
bool escape)
:
RWXmlObjectOutputStreamImp(RWOstreamDataToCharOutputStreamImp::make(
RWXsltCharOutputStreamImp::make(
RWCharToStreambufOutputStreamImp::make(*(ostr.rdbuf())),
transformer)), rootElementType,escape)
{;}
 
public:
 
static RWObjectOutputStream make(std::ostream& sink,
std::istream& script,
const RWCString& rootElementType=nestedObjectTag,
bool escape = true)
{
return RWObjectOutputStream(new
RWXsltObjectOutputStreamImp(sink,
RWTXsltTransform<char>(script),
rootElementType,escape));
}
};
You now have everything you need to apply XSLT transformations to the XML input or output using the Xalan XSLT engine.
The next section describes how to use these objects to perform an actual transformation.