/** * Takes a Receiver that expects raw output (such as might be obtained from {@link Destination#getReceiver}) * and prepends a pipeline of receivers needed to support transformation tasks, especially a * {@link ComplexContentOutputter}. * @param out a receiver expecting raw output * @return a receiver to which instructions in the stylesheet can write events. This receiver will have * been opened. * @throws XPathException if any failure occurs */ private Receiver prepareOutputReceiver(Receiver out) throws XPathException { principalResult = out; if (principalResultURI == null) { principalResultURI = out.getSystemId(); } //out = new RegularSequenceChecker(out); // uncomment for debugging //out = new TracingFilter(out); // uncomment for debugging NamespaceReducer nr = new NamespaceReducer(out); ComplexContentOutputter cco = new ComplexContentOutputter(nr); cco.setSystemId(out.getSystemId()); out = cco; if (getExecutable().createsSecondaryResult()) { // This is for the case where the stylesheet writes no output to the primary destination, // and then calls xsl:result-document with a null or empty href, in which case the xsl:result-document // output is sent to the primary output destination, but with different serialization properties. out = this.gatekeeper = new PrincipalOutputGatekeeper(this, out); } out.open(); return out; }
/** * Takes a Receiver that expects raw output (such as might be obtained from {@link Destination#getReceiver}) * and prepends a pipeline of receivers needed to support transformation tasks, especially a * {@link ComplexContentOutputter}. * @param out a receiver expecting raw output * @return a receiver to which instructions in the stylesheet can write events. This receiver will have * been opened. * @throws XPathException if any failure occurs */ private Receiver prepareOutputReceiver(Receiver out) throws XPathException { principalResult = out; if (principalResultURI == null) { principalResultURI = out.getSystemId(); } //out = new RegularSequenceChecker(out); // uncomment for debugging //out = new TracingFilter(out); // uncomment for debugging NamespaceReducer nr = new NamespaceReducer(out); ComplexContentOutputter cco = new ComplexContentOutputter(nr); cco.setSystemId(out.getSystemId()); out = cco; if (getExecutable().createsSecondaryResult()) { // This is for the case where the stylesheet writes no output to the primary destination, // and then calls xsl:result-document with a null or empty href, in which case the xsl:result-document // output is sent to the primary output destination, but with different serialization properties. out = this.gatekeeper = new PrincipalOutputGatekeeper(this, out); } out.open(); return out; }