Defining the XSLT Transformation Input Stream
This code can be found in buildspace\ examples\xmlstreams\xsltTransform\-XsltObjectInputStreamImp.h.
 
class RWXsltObjectInputStreamImp : public RWXmlObjectInputStreamImp
{
protected:
RWXsltObjectInputStreamImp(std::istream& istr,
RWTXsltTransform<char> transformer,
bool escape) // 1
:
RWXmlObjectInputStreamImp(RWIstreamDataFromCharInputStreamImp::make(
RWXsltCharInputStreamImp::make(
RWCharFromStreambufInputStreamImp::make(
*(istr.rdbuf())),transformer)),escape) // 2
{;}
 
public:
static RWObjectInputStream make(std::istream& source,
std::istream& script, bool escape = true) // 3
{
return RWObjectInputStream(new
RWXsltObjectInputStreamImp(source,
RWTXsltTransform<char>(script,escape));
}
};
 
//1 The constructor for the transformation stream takes an input stream for the XML document to transform, a transformation object, and a flag to indicate whether or not the output should be escaped.
//2 Here you initialize the base class using the char transformation stream defined by the typedef above. Note that you
*first create a character input stream,
*then use that to create the Xalan transformation char input stream,
*then use the Xalan char stream to create an Istream input stream,
* and finally use that stream to create the base RWXmlObjectInputStreamImp. This is an example of chaining together streaming elements to create a new stream with specific functionality (in this case the ability to transform an XML document using XSLT).
//3 The static make() function produces an object stream handle by creating a Xalan transformation stream. Here you construct a transformation object and pass it to the constructor for the Xalan transformation stream.