XslCompiledTransform.CompileToType Method

Compiles an XSLT style sheet to a specified type.

Namespace:  System.Xml.Xsl
Assembly:  System.Xml (in System.Xml.dll)

public static CompilerErrorCollection CompileToType(
	XmlReader stylesheet,
	XsltSettings settings,
	XmlResolver stylesheetResolver,
	bool debug,
	TypeBuilder typeBuilder,
	string scriptAssemblyPath
)

Parameters

stylesheet
Type: System.Xml.XmlReader

An XmlReader positioned at the beginning of the style sheet to be compiled.

settings
Type: System.Xml.Xsl.XsltSettings

The XsltSettings to be applied to the style sheet. If this is null, the Default will be applied.

stylesheetResolver
Type: System.Xml.XmlResolver

The XmlResolver use to resolve style sheet modules referenced in xsl:import and xsl:include elements. If this is null, external resources will not be resolved.

debug
Type: System.Boolean

Setting this to true enables debugging the style sheet with a debugger.

typeBuilder
Type: System.Reflection.Emit.TypeBuilder

The TypeBuilder used for the style sheet compilation. The provided TypeBuilder is used to generate the resulting type.

scriptAssemblyPath
Type: System.String

The base path for the assemblies generated for msxsl:script elements. If only one script assembly is generated, this parameter specifies the path for that assembly. In case of multiple script assemblies, a distinctive suffix will be appended to the file name to ensure uniqueness of assembly names.

Return Value

Type: System.CodeDom.Compiler.CompilerErrorCollection
A CompilerErrorCollection object containing compiler errors and warnings that indicate the results of the compilation.

The xsltc.exe tool is a wrapper around the CompileToType method. Compiling style sheets with the xsltc.exe will meet the demands of most applications that leverage the use of compiled style sheets. The CompileToType method should be used when building custom compilation tools.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5 SP1, 3.0 SP1, 2.0 SP1

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2015 Microsoft