##register-api ( assembly-name, class-name, prefix )


This directive allows you to add a class as XSLT extension object.
  • assembly-name - name of assembly where your API resides. Can be put in Bin folder or in GAC.
  • class-name - name of class including full namespace. This class MUST have parameterless constructor. All public instance methods of the class will be exposed as extension methods into XSLT.
  • prefix - prefix name that will identify your class within XSLT code.

Example.

1. Define a class


namespace XTest
{
    public class XClass
    {
        public string SomeMethod()
        {
            return "I'm some method...";
        }
    }
}

2. Compile and copy XTest.dll to your site's Bin folder
Or, optionally, you can put the assembly into GAC.

3. Create XsltDb module and write the following


##register-api(XTest, XTest.XClass, some)
<xsl:value-of select="some:SomeMethod()"/>

Last edited Jul 20, 2011 at 6:49 AM by findy, version 1

Comments

trapias Jul 20, 2011 at 8:41 AM 
Very interesting! :-)