Resolving External XSLT Style Sheets and Documents
There are several times during a transformation when you may need to resolve external resources.
There are several times during a transformation when you may need to resolve external resources:
If you have a custom XmlResolver that you want to use, or if you need to specify different credentials, the following table lists the task required, depending on when the external resource needs resolution.
What process requires resolution
During Load to locate the style sheet.
During Load to resolve <xsl:include> or <xsl:import>.
Specify the overloaded Load method that takes, as a parameter, an XmlResolver. The XmlResolver is used to load the style sheets referenced by the import or include statements. If you pass in null, the external resources are not resolved.
During a transformation to resolve any document() functions.
The document() function retrieves other XML resources from a style sheet, in addition to the initial XML data provided by the input stream. Since this function allows the inclusion of XML data that can be located elsewhere, an XmlResolver with a null value supplied to the Transform method prevents the document() function from executing. If you want to use the document() function, use the Transform method that takes an XmlResolver as a parameter, in addition to having the appropriate permission set.
When the Transform method is called, permissions are calculated against the evidence provided at load time, and that permission set is assigned to the entire transformation process. If the document() function attempts to initiate an action that requires permissions not found in the set, an exception is thrown.
XSLT Transformations with the XslTransform Class
XslTransform Class Implements the XSLT Processor
Outputs from an XslTransform
XSLT Transformations Over Different Stores
XsltArgumentList for Style Sheet Parameters and Extension Objects
XSLT Stylesheet Scripting Using <msxsl:script>
Support for the msxsl:node-set() Function
XPathNavigator in Transformations
XPathNodeIterator in Transformations
XPathDocument Input to XslTransform
XmlDataDocument Input to XslTransform
XmlDocument Input to XslTransform