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"
Registering the extension in the xsl file
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
<xsl:value-of select="MyExtension:HelloWorld()" />
Binding the XML control to the XML Data
protected override void OnInit(EventArgs e)
string xmlContent = "xml data goes here";
XsltArgumentList list = new XsltArgumentList();
Utils.XslHelper ext = new Utils.XslHelper();
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'.