Copied to clipboard

Flag this post as spam?

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


  • Max Mumford 266 posts 293 karma points
    Sep 26, 2011 @ 11:01
    Max Mumford
    0

    Custom Umbraco XSLT Namespace - Prefix not defined

    Hi all!

    I am following the video here:

    http://umbraco.com/help-and-support/video-tutorials/developing-with-umbraco/easier-xslt-and-rest-extensions/xsltextension-attribute/TVPlayerPopup

    To create my own XSLT extension class so I can use .net methods in my xslt select statements. I built the extension, copied the DLL into the bin folder of umbraco and in the XSLT editor I can see my class and method in the "insert xslt:value-of" - get extensions window and insert the script into the XSLT file. Problem is, when I go to save the file I get the following error:

     

    Error occured

    System.Xml.Xsl.XslLoadException: Prefix 'umbracoSiteModulesCS' is not defined. An error occurred at c:\inetpub\umbracoSite\xslt\634526278492824590_temp.xslt(8,3). 
    at System.Xml.Xsl.XslCompiledTransform.LoadInternal(Object stylesheet, XsltSettings settings, XmlResolver stylesheetResolver) 
    at umbraco.presentation.webservices.codeEditorSave.SaveXslt(String fileName, String oldName, String fileContents, Boolean ignoreDebugging)

     

    Any ideas why this is happening?

    Thanks,

    Max.

  • Lee Kelleher 4020 posts 15802 karma points MVP 13x admin c-trib
    Sep 26, 2011 @ 11:11
    Lee Kelleher
    0

    Hi Max,

    Unfortunately, for existing XSLT files, the new namespaces are not automatically added to the header, so you will need to add it manually.

    <xsl:stylesheet
        version="1.0"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
        xmlns:msxml="urn:schemas-microsoft-com:xslt"
        xmlns:umbraco.library="urn:umbraco.library"
        xmlns:umbracoSiteModulesCS="urn:umbracoSiteModulesCS"
        exclude-result-prefixes="msxml umbraco.library umbracoSiteModulesCS">

    Do be sure to check if you have other namespaces that you use (e.g. the EXSLT ones) ... you'd need to keep those in there too!

    Cheers, Lee.

  • Max Mumford 266 posts 293 karma points
    Sep 26, 2011 @ 11:17
    Max Mumford
    0

    Thanks! That did it. Ended up re-creating the xslt file which added the following:

    xmlns:*DLL Name*.*Project Name*.*Class Name*="urn:*DLL Name*.*Project Name*.*Class Name*" 

    And to "exclude-result-prefixes" added:

    *DLL Name*.*Project Name*.*Class Name*

Please Sign in or register to post replies

Write your reply to:

Draft