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));
}
};
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).