The XSLT language has features such as xsl:import, xsl:include, or the document() function, where the processor needs to resolve URI references. The XmlResolver class is used to resolve external resources. External resources may need to be resolved in the following two cases:
When compiling a style sheet, the XmlResolver is used for xsl:import and xsl:include resolution.
When executing the transformation, the XmlResolver is used to resolve the document() function.
The Load and Transform methods each include overloads that accept an XmlResolver as one of its arguments. If an XmlResolver is not specified, a default XmlUrlResolver with no credentials is used.
Guidelines
Enable the document() function only when the style sheet comes from a trusted source.
The following list describes when you may want to specify an XmlResolver object:
If the XSLT process needs to access a network resource that requires authentication, you can use an XmlResolver with the necessary credentials.
If you want to restrict the resources that the XSLT process can access, you can use an XmlSecureResolver with the correct permission set. Use the XmlSecureResolver class if you need to open a resource that you do not control, or that is untrusted.
If you want to customize behavior, you can implement your own XmlResolver class and use it to resolve resources.
If you want to ensure that no external resources are accessed, you can specify null for the XmlResolver argument.