Saxon.Api

 

 

Saxon.Api

Interface IResultDocumentHandler


public interface IResultDocumentHandler

An IResultDocumentHandler can be nominated to handle output produced by the xsl:result-document instruction in an XSLT stylesheet.

This interface affects any xsl:result-document instruction executed by the stylesheet, provided that it has an href attribute.

If no IResultDocumentHandler is nominated (in the IResultDocumentHandler property of the XsltTransformer), the output of xsl:result-document is serialized, and is written to the file or other resource identified by the URI in the href attribute, resolved (if it is relative) against the URI supplied in the BaseOutputUri property of the XsltTransformer.

If an IResultDocumentHandler is nominated, however, its HandleResultDocument method will be called whenever an xsl:result-document instruction with an href attribute is evaluated, and the generated result tree will be passed to the XmlDestination returned by that method.

Method Summary

 XmlDestination HandleResultDocument(string href, Uri baseUri)

Handle output produced by the xsl:result-document instruction in an XSLT stylesheet. This method is called by the XSLT processor when an xsl:result-document with an href attribute is evaluated.

 

Method Detail

HandleResultDocument

public XmlDestination HandleResultDocument(string href,
Uri baseUri)

Handle output produced by the xsl:result-document instruction in an XSLT stylesheet. This method is called by the XSLT processor when an xsl:result-document with an href attribute is evaluated.

The XSLT processor will ensure that the stylesheet cannot create two distinct result documents which are sent to the same URI. It is the responsibility of the IResultDocumentHandler to ensure that two distinct result documents are not sent to the same XmlDestination. Failure to observe this rule can result in output streams being incorrectly closed.

Note that more than one result document can be open at the same time, and that the order of opening, writing, and closing result documents chosen by the processor does not necessarily bear any direct resemblance to the way that the XSLT source code is written.

Parameters:

href - An absolute or relative URI. This will be the effective value of the href attribute of the xsl:result-document in the stylesheet.
baseUri - The base URI that should be used for resolving the value of href if it is relative. This will always be the value of the BaseOutputUri property of the XsltTransformer.

Returns:

An XmlDestination to handle the result tree produced by the xsl:result-document instruction. The Close method of the returned XmlDestination will be called when the output is complete.