Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at

  • George 58 posts 165 karma points
    Jan 09, 2014 @ 14:15

    How to include xslt extension in umbraco 7 ?

    Hello everyone

    I recently updated my umbraco site from version 4.9 to version 7.0.1
    I had some code for the site that provided various database interaction methods, written in C# and it is compiled and copied into my /bin folder as My-Project.dll

    Since version 7.01 of umbraco uses .NET 4.5, I had to upgrade my visual studio 2010 to 2013 to be able to compile my .NET 4.5 code that references umbraco.dll .

    I had some calls to my code in xslt defined as 

    <xsl:variable name="pagingData" select="My_Project:GetProductCountXML($n1, $n2, $n3, $n4)/descendant-or-self::pageing" />

    This throws an exception : Cannot find a script or an extension object associated with namespace 'urn:My_Project'

    I have the following definition in my xslt file:

    And I have also declared it in my /config/xsltExtensions.config as
    <ext assembly="My-Project" type="My_Project.ProductList" alias="My-ProdList" />

    Where My_Project.ProductList is a class that's a part of My-Project.dll that has a method called GetProductCountXML() that takes 4 parameters.

    The setup I described above used to work before I updated umbraco to version 7.0.1 and .NET target version of my project from 4.0 to 4.5 (so it could work with umbraco.dll of version 7)

    EDIT : Recreated my topic in xslt section , admins please delete old one :
    EDIT: I see that /config/xsltExtensions.config has been removed, but I haven't found a way to include the extentions in umbraco 7

  • Chriztian Steinmeier 2762 posts 8528 karma points MVP 6x admin c-trib
    Jan 09, 2014 @ 14:27
    Chriztian Steinmeier

    Hi René - I've deleted the old topic as requested (was just about to move it here :-)

    I think you just need to add an [XsltExtension] attribute to your C# class/module/... but I should in no way be allowed to answer that, since I'd only open Visual Studio when threatened with fire or Hello Kitties :-)

    I'm sure someone will chip in with the answer you're looking for; I'll poke the Twittersphere...


  • Comment author was deleted

    Jan 09, 2014 @ 14:29
  • George 58 posts 165 karma points
    Jan 09, 2014 @ 14:59

    Chriztian is right, just have to include the name of the extention I am calling in the attribute like [XsltExtension("My-ProdList")] just before my class declaration.

    Lee linked a good example that solves the problem here :

    Thanks to everyone for the quick replies!

Please Sign in or register to post replies

Write your reply to: