Registering XSLT Extension Objects with the ASP XML control

by aboo bolaky 23. October 2009 07:01

I once inherited a sublayout that inlcuded an asp:xml control. The asp:xml control was there to handle and display an xml feed from another system, while the rest of the sublayout concentrated on rendering related feed content from Sitecore. The presentation of the xml feed was handled via an xlst rendering.

In this particular situation, I made use use of XSL extensions in the XSLT file. Registering the XSL Extension was fairly easy.

	<extension mode="on" type="Utils.XslHelper, Utils"
		   singleInstance="true" />

Registering the extension in the xsl file

<xsl:stylesheet version="1.0" xmlns:xsl=""
 exclude-result-prefixes="MyExtension" >

<xsl:value-of select="MyExtension:HelloWorld()" />

Binding the XML control to the XML Data

protected override void OnInit(EventArgs e)
        if (!this.IsPostBack)
            string xmlContent = "xml data goes here";
            XsltArgumentList list = new XsltArgumentList();
            Utils.XslHelper ext = new Utils.XslHelper();
            list.AddExtensionObject("", ext);
            Xml1.TransformArgumentList = list;
            Xml1.DocumentContent = xmlContent;

It turns out that, even though I had previously registered the xsl extension in the xslt file, I also had to register it via code as well. Otherwise, the following exception occurs at runtime.

Cannot find the script or external object that implements prefix 'MyExtension'.


Tags: ,

.Net | Asp.Net | Sitecore | Tips & Tricks


11/7/2011 2:55:21 PM #

Marrakech guide

I gotta special this locale it appears same cooperative same desirable

Marrakech guide France |

11/13/2011 2:12:53 PM #


Its cherish you understand my ideas! You seem to clutch so much approximately this, cherish you wrote the e-reserve in it or something. I perceive that you could do with a few p.c. to push the meaning home a miniature iota, except other than that, this is fantastic blog. A fantastic understand. I’ll certainly be back

Marrakech France |

11/16/2011 5:51:22 AM #

vente immobilier au maroc

I possess recently started a blog, the report you endow on this website has helped me greatly. Blesss for total of your epoch & process. “It is no employ motto, ‘We are doing our cream.’ You contain got to arrive in doing what is important.” by Sir Winston Churchill.

vente immobilier au maroc France |

Tag cloud

Flash Player 9 required.

About Me

I wish I could write something here..
//TODO: ElaborateMe