いくつかのXSL変換の出力をFopFactoryオブジェクトにパイプする必要がありますが、これをコーディングする方法がわかりません。配管は機能していますが、最後のステップは謎です。
DOMResult xmlRequest = new DOMResult();
marshaller.marshal(req,xmlRequest);
FopFactory fopFactory = FopFactory.newInstance();
FOUserAgent foUserAgent = fopFactory.newFOUserAgent();
ByteArrayOutputStream out = new ByteArrayOutputStream();
Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, foUserAgent, out);
XdmNode source = processor.newDocumentBuilder()
.build(new DOMSource(xmlRequest.getNode()));
XsltTransformer step1 = templateCache.get("foo1.xsl").load();
XsltTransformer step2 = templateCache.get("foo2.xsl").load();
XsltTransformer step3 = templateCache.get("foo3_fo.xsl").load();
step1.setInitialContextNode(source);
step1.setDestination(step2);
step2.setDestination(step3);
// Here's what I really need to do -- pipe the output of step3 into the FO processor.
// Of course, the following statement doesn't work, but I don't know what I need
// to do to make the output of step3 piped into the fop, so the
step3.setDestination(fop.getDefaultHandler());
step1.transform();
// at this point, the results of the FOP processor would be in the
// ByteArrayOutputStream "out".
どうすればこれを機能させることができますか?