Saxon API for .NET

XsltCompiler.Compile Method (Stream)

Compile a stylesheet supplied as a Stream.

public XsltExecutable Compile(
   Stream input
);

Parameters

input
A stream containing the source text of the stylesheet

Return Value

An XsltExecutable which represents the compiled stylesheet object. The XsltExecutable may be loaded as many times as required, in the same or a different thread. The XsltExecutable is not affected by any changes made to the XsltCompiler once it has been compiled.

Remarks

If the stylesheet contains any xsl:include or xsl:import declarations, then the BaseURI property must be set to allow these to be resolved.

The stylesheet is contained in the part of the input stream between its current position and the end of the stream. It is the caller's responsibility to close the input stream after use. If the compilation succeeded, then on exit the stream will be exhausted; if compilation failed, the current position of the stream on exit is undefined.

Example

            Stream source = new FileStream("input.xsl", FileMode.Open, FileAccess.Read);
            XsltExecutable q = compiler.Compile(source);
            source.Close();
            

See Also

XsltCompiler Class | Saxon.Api Namespace | XsltCompiler.Compile Overload List