Saxon API for .NET |

# IResultDocumentHandler.HandleResultDocument Method

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.

XmlDestination HandleResultDocument(
string href,
Uri baseUri
);

#### 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`.

#### Return Value

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.

#### Remarks

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 set 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.

#### See Also

IResultDocumentHandler Interface | Saxon.Api Namespace