Skip to content

Latest commit

 

History

History
37 lines (23 loc) · 2.23 KB

xslt-extension-objects.md

File metadata and controls

37 lines (23 loc) · 2.23 KB
description title ms.date ms.assetid
Learn more about: XSLT Extension Objects
XSLT Extension Objects
03/30/2017
a4ebdbad-087c-4cfe-acc0-17c48142f81a

XSLT Extension Objects

Extension objects are used to extend the functionality of style sheets. Extension objects are maintained by the xref:System.Xml.Xsl.XsltArgumentList class.

The following are advantages to using an extension object rather than embedded script:

  • Provides better encapsulation and reuse of classes.

  • Allows style sheets to be smaller and more maintainable.

XSLT extension objects are added to the xref:System.Xml.Xsl.XsltArgumentList object using the xref:System.Xml.Xsl.XsltArgumentList.AddExtensionObject%2A method. A qualified name and namespace URI are associated with the extension object at that time.

Note

The FullTrust permission set is required to call the xref:System.Xml.Xsl.XsltArgumentList.AddExtensionObject%2A method. For more information, see Code Access Security and Named Permission Sets.

The data types returned from extension objects are one of the four basic XPath data types of number, string, Boolean, and node set.

Any method that is defined with the params keyword, which allows an unspecified number of parameters to be passed, is not currently supported by the xref:System.Xml.Xsl.XslCompiledTransform class. XSLT style sheets that utilize any method defined with the params keyword will not work correctly. For details, see params.

To use an XSLT extension object

  1. Create an xref:System.Xml.Xsl.XsltArgumentList object and add the extension object using xref:System.Xml.Xsl.XsltArgumentList.AddExtensionObject%2A method.

  2. Call the extension object from the style sheet.

  3. Pass the xref:System.Xml.Xsl.XsltArgumentList object to the xref:System.Xml.Xsl.XslCompiledTransform.Transform%2A method.

See also