I've been transferring a lot of our Umbraco 6.1.5 assets into a sandboxed copy of Umbraco 7. This is a fresh installation of Umbraco 7 but I have a page that makes use of the simple "lowercase" function using the syntax:
Exslt.ExsltStrings:lowercase(node)
The exact error I see occuring in the log is:
Cannot find a script or an extension object associated with namespace 'urn:Exslt.ExsltStrings
Has anything changed in the latest version of Umbraco? How can I run a lowercase function in 7? Is this build missing this extension object?
The EXSLT extension methods have been removed from Umbraco 7 (for various reasons - most of which many of them were broken). I've made a simple package that will bring back the features for Umbraco 7. I hope this helps?
For this initial release I've taken a direct copy from the Umbraco 6.2.0 source-code. So it contains the exact same code.
Moving forwards I may take a look at fixing the issues, but I had tried that previously (whilst it was still in the Umbraco core) and failed to figure it out. (There's some complex things going on with XPathArrayIterators)
Was hoping your package would ressurect the Umbraco Tag xslt extension...but it doesn't appear so. Do you know how I might be able to access it in Umbraco 7?
Previously I would include it in the xsltExtensions.config file: <ext assembly="umbraco.editorControls" type="umbraco.editorControls.tags.library" alias="tags" />
And then reference it in my xslt controls. I'm really in a bind without this. Thoughts?
If you don't want to add the namespaces to your XSLT files by hand, simply just add your .dll file to the bin folder, and then create a new xslt file. Then the namespaces should be added automatically.
Appreciate your response. Still a bit confused as to how to include it. For including the dll files, I'm not sure which ones to grab. Since umbraco.EditorControls.dll is already included in Umbraco 7. And this appears to be what is providing the tags library functions.
As an immediate quick-fix, try this... create a file in your /App_Code folder called TagsLibrary.cs and put the following code in it:
namespace Our.Umbraco
{
[umbraco.XsltExtension("tags")]
public class TagsLibrary : umbraco.editorControls.tags.library
{
}
}
Now all your old "tags" should work in your XSLTs again.
What this code is doing is wrapping the old 'tag library' code within a new class and marking that as an XSLT extension. It's a bit hacky, but should work fine.
Sorry for the 20 questions I'm a bit of a novice when it comes to custom class libraries, Lee...and thanks again.
I set a new project/class library in VS2013. I added a reference to umbraco.editorControls. The line "[umbraco.XsltExtension("tags")]" is coming back with an error of it not being an attribute class. Is my syntax off? Code below.
namespace TagsLibrary { [umbraco.XsltExtension("tags")] public class TagsLibrary : umbraco.editorControls.tags.library { }
Hi Lee, thanks again for your help and responsiveness. It turned out to by the Umbraco.Core.dll.
I was able to compile the class library and dropped the DLL out into my bin folder. Unfortunately, I'm still getting the same xslt error "
Cannot find a script or an extension object associated with namespace 'urn:tags'
I tried creating a fresh xslt file thinking the new class would be picked up in the extension declarations, but it wasn't. Is there some other step I'm missing? Here's my final class code:
namespace TagsLibrary { [umbraco.XsltExtension("tags")] public class TagsLibrary : umbraco.editorControls.tags.library { } }
Reason for all this trouble is I'm trying to reuse some fairly complex legacy xslt code. Eventually, I'd like to rewrite it in Razor but it's feasible for this one. Thanks, Justin
Hi Justin, to be honest I'm confused to why it's not working - at the moment I don't have another solution. If the macro isn't too complex, I'd suggest attempting to port it over to Razor. Unless anyone else has a better idea?
I think the proposed method cannot work, because Xslt requires the methods to be static. So inheriting from the library gives nothing at all. The new class will have no static methods, and only have the inherited instance methods (in this case none)
So to get it to work, you must not inherit from umbraco.editorControls.tags.library,
Instead you must declare matching static methods, that in turn will call the static methods on library.
Umbraco 7 - XSLT Error Due to Missing Extension
I've been transferring a lot of our Umbraco 6.1.5 assets into a sandboxed copy of Umbraco 7. This is a fresh installation of Umbraco 7 but I have a page that makes use of the simple "lowercase" function using the syntax:
The exact error I see occuring in the log is:
Has anything changed in the latest version of Umbraco? How can I run a lowercase function in 7? Is this build missing this extension object?
Thanks in advance for any assistance!
Looking at the stylesheet element I have identified a difference in this version when creating a 'clean' XSLT file:
Umbraco 7 creates:
<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:Examine="urn:Examine" exclude-result-prefixes="msxml umbraco.library Examine ">
Where 6.1.5 created:
<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:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets" exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets ">
Hi Thomas,
The EXSLT extension methods have been removed from Umbraco 7 (for various reasons - most of which many of them were broken). I've made a simple package that will bring back the features for Umbraco 7. I hope this helps?
http://our.umbraco.org//projects/website-utilities/exslt-redux
Cheers,
- Lee
Hi Lee
Have you fixed the broken modules or are you only providing the ones that still work?
Hi Martin,
For this initial release I've taken a direct copy from the Umbraco 6.2.0 source-code. So it contains the exact same code.
Moving forwards I may take a look at fixing the issues, but I had tried that previously (whilst it was still in the Umbraco core) and failed to figure it out. (There's some complex things going on with
XPathArrayIterators
)The source-code is up on GitHub if anyone is inclined to have a go :-)
Cheers,
- Lee
I dont suppose you know offhand, which ones are broken? Or which ones definitely work?
Yup, I listed them on ticket #U4-2742...
Hi Lee,
Was hoping your package would ressurect the Umbraco Tag xslt extension...but it doesn't appear so. Do you know how I might be able to access it in Umbraco 7?
Previously I would include it in the xsltExtensions.config file: <ext assembly="umbraco.editorControls" type="umbraco.editorControls.tags.library" alias="tags" />
And then reference it in my xslt controls. I'm really in a bind without this. Thoughts?
Thanks,
Justin
Hi Justin
Hope you don't mind my giving an answer :)
In Umbraco 7 you need to add XSLT extensions by adding annotations in the assembly containing your xslt extensions.
Lee has written about it here http://our.umbraco.org/forum/developers/xslt/46533-no-more-xsltExtensionsconfig-in-Umb-7#comment169440 and you can find more information about it on the issue tracker here http://issues.umbraco.org/issue/U4-2742
If you don't want to add the namespaces to your XSLT files by hand, simply just add your .dll file to the bin folder, and then create a new xslt file. Then the namespaces should be added automatically.
Hope this helps.
/Jan
Hi Jan,
Appreciate your response. Still a bit confused as to how to include it. For including the dll files, I'm not sure which ones to grab. Since umbraco.EditorControls.dll is already included in Umbraco 7. And this appears to be what is providing the tags library functions.
Thanks much,
Justin
Hi Justin,
As an immediate quick-fix, try this... create a file in your
/App_Code
folder calledTagsLibrary.cs
and put the following code in it:Now all your old "tags" should work in your XSLTs again.
What this code is doing is wrapping the old 'tag library' code within a new class and marking that as an XSLT extension. It's a bit hacky, but should work fine.
Cheers,
- Lee
Hi Lee,
Thanks a lot for the tip. I've got the class file in place. That seems fine. When I try to save my xslt though, it's throwing an error --
Here's how I'm declaring the extension in my xslt
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:Examine="urn:Examine" xmlns:tags="urn:tags"
exclude-result-prefixes="msxml umbraco.library Examine tags ">
Thanks,
Justin
Here's my class file.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
/// <summary>
/// Summary description for TagLibrary
/// </summary>
///
namespace Our.Umbraco
{
[umbraco.XsltExtension("tags")]
public class TagsLibrary : umbraco.editorControls.tags.library
{
}
}
@Justin - Just checking, the code file is in the
/App_Code
folder?Yes, /App_code/TagLibrary.cs
Ah, it seems to be an issue with
XsltExtensions
inApp_Code
not being recognised in v7. (See #U4-3425 for more details)So for this to work, you'd need to compile the class into an assembly/DLL and put it in your
/bin
folder.Sorry for the 20 questions I'm a bit of a novice when it comes to custom class libraries, Lee...and thanks again.
I set a new project/class library in VS2013. I added a reference to umbraco.editorControls. The line "[umbraco.XsltExtension("tags")]" is coming back with an error of it not being an attribute class. Is my syntax off? Code below.
namespace TagsLibrary
{
[umbraco.XsltExtension("tags")]
public class TagsLibrary : umbraco.editorControls.tags.library
{
}
}
Hi Justin, no worries - just wish it was easier to help out.
For the
umbraco.XsltExtension
attribute, you'll also need to reference theumbraco.dll
(and possiblyUmbraco.Core.dll
)Hi Lee, thanks again for your help and responsiveness. It turned out to by the Umbraco.Core.dll.
I was able to compile the class library and dropped the DLL out into my bin folder. Unfortunately, I'm still getting the same xslt error "
I tried creating a fresh xslt file thinking the new class would be picked up in the extension declarations, but it wasn't. Is there some other step I'm missing? Here's my final class code:
Reason for all this trouble is I'm trying to reuse some fairly complex legacy xslt code. Eventually, I'd like to rewrite it in Razor but it's feasible for this one.
Thanks,
Justin
Hi Lee, any other thoughts/options on this one? Or do I need to start rebuilding my macro not using XSLT?
Hi Justin, to be honest I'm confused to why it's not working - at the moment I don't have another solution. If the macro isn't too complex, I'd suggest attempting to port it over to Razor. Unless anyone else has a better idea?
Sadly, it's very complex. I'm going to keep trying to crack how to use the XSLT extensions. Thanks again for your help.
Hello,
Sorry to resurrect an old thread.
I think the proposed method cannot work, because Xslt requires the methods to be static. So inheriting from the library gives nothing at all. The new class will have no static methods, and only have the inherited instance methods (in this case none)
So to get it to work, you must not inherit from umbraco.editorControls.tags.library,
Instead you must declare matching static methods, that in turn will call the static methods on library.
Just a though. :-)
I haven't tried it.
Kind regards,
Jesper
is working on a reply...