Interface ResultDocumentResolver
-
- All Known Implementing Classes:
OutputURIResolverWrapper,StandardResultDocumentResolver
public interface ResultDocumentResolverThe ResultDocumentResolver interface may be implemented by a user application; it is a callback that is called whenever an xsl:result-document instruction is executed.There is a single method:
resolve(XPathContext, String, String, SerializationProperties). Saxon calls this method supplying the dynamic evaluation context, together with the value of the href attribute and the output base URI for the transformation.The result of the callback is an application-supplied instance of the
Outputterinterface. Saxon will send events to thisReceiver, representing the raw results of thexsl:result-documentinstruction. If the application wants results in the form of a document node generated using sequence normalization, then it must include aSequenceNormalizerin the output pipeline.The
ResultDocumentResolveris called for everyxsl:result-documentinstruction whether or not it specifies anhrefattribute.The implementation must be thread-safe (calls to
xsl:result-documentmay occur in several threads concurrently). The returnedReceivermay be called in a different thread.If the application wishes to take action when the
xsl:result-documentinstruction finishes, that is, when the results are available for use, then it should intercept theOutputter.close()call on the returnedReceiver. This can be done (for example) by adding aCloseNotifierto the output pipeline, or by use of theSequenceNormalizer.onClose(java.util.List<net.sf.saxon.s9api.Action>)method.This interface supersedes the
OutputURIResolverinterface provided in earlier Saxon releases. TheOutputURIResolverwas limited because it did not have access to the dynamic context, nor to the serialization parameters, and it did not handle raw output as required by the XSLT 3.0 specification, needed in particular to create JSON output documents.- Since:
- 9.9
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Receiverresolve(XPathContext context, java.lang.String href, java.lang.String baseUri, SerializationProperties properties)Saxon calls this method when anxsl:result-documentinstruction with anhrefattribute is evaluated.
-
-
-
Method Detail
-
resolve
Receiver resolve(XPathContext context, java.lang.String href, java.lang.String baseUri, SerializationProperties properties) throws XPathException
Saxon calls this method when anxsl:result-documentinstruction with anhrefattribute is evaluated.Note: it may be appropriate for the method to obtain a suitable
Receiverby calling one of the static factory methods on theSerializerFactoryclass. ASerializerFactorycan be obtained by callingcontext.getConfiguration().getSerializerFactory().- Parameters:
context- the dynamic evaluation contexthref- the effective value of thehrefattribute ofxsl:result-documentinstruction. This will be a zero-length string if the attribute is omitted.baseUri- the base output URI of the transformation (typically, the destination of the principal output destination). This may be null if no base output URI is known. The recommended action if it is null is to use thehrefvalue alone if it is absolute URI, otherwise to raise an error (SaxonErrorCode.SXRD0002, since there is no W3C-defined code for the condition).properties- the serialization properties defined explicitly or implicitly on thexsl:result-documentinstruction, together with information about character maps in the stylesheet that might be referenced. Serialization parameters can be ignored if the result document is not being serialized. However, if the serialization parameters include a validation factory, then this must not be ignored: a validator must be inserted at a suitable point in the output pipeline.- Returns:
- a new instance of the
Receiverclass, which Saxon will then call to open the output document, and subsequently to close it. ThisReceiverwill receive a sequence of events representing the raw result of thexsl:result-documentinstruction, as a regular event sequence conforming to the rules defined inRegularSequenceChecker.The implementation should set the
systemIdproperty of the returnedReceiverto the result of resolving the suppliedhrefagainst the suppliedbaseUri. On return from this method, Saxon will check that thesystemIdis non-null and that it satisfies the uniqueness conditions imposed by the XSLT specification. Specifically, it is not permitted for two calls onxsl:result-documentto use the same URI, and this URI must not be read in a call ondoc()ordocument(), either before or after executing thexsl:result-documentinstruction. - Throws:
XPathException- if a result document cannot be opened
-
-