Getting umbraco.library to associate with external xsl Options
rorythecheese
Posted: Thursday, March 27, 2008 3:40:41 PM

Rank: Newbie

Joined: 2/15/2008
Posts: 16
Location: London, England
Hello folks, was wondering if there's a simple way to get umbraco to be able to recognise an external xsl file so that i can use the umbraco.library functions in that file?

At the moment i have a couple of sites running umbraco and they communicate by outputting an extra custom xml using xsl. But in this xsl i want to be able to use umbraco.library:GetMedia to pass across the URL, of images in my media library, plus NiceUrls.

So i essentially need umbraco to view my external xsl file as one of it's own, and to use the umbraco.library. Is this possible?

Also our developer, in making the external xml & xsl files had to overide the way umbraco makes "application page calls" so that the external file is updated when the umbraco.config is too. So he said this may be a problem in getting this to work.

ANy help would be great . Cheers.

He added the following in a web.config

Code:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <appSettings>
        <remove key="umbracoUseDirectoryUrls" />
        <remove key="umbracoTimeOutInMinutes" />
        <remove key="umbracoStorageDirectory" />
        <remove key="umbracoSmtpServer" />
        <remove key="umbracoReservedUrls" />
        <remove key="umbracoReservedPaths" />
        <remove key="umbracoPath" />
        <remove key="umbracoHideTopLevelNodeFromPath" />
        <remove key="umbracoEnableStat" />
        <remove key="umbracoEditXhtmlMode" />
        <remove key="umbracoDisableXsltExtensions" />
        <remove key="umbracoDisableVersionCheck" />
        <remove key="umbracoDefaultUILanguage" />
        <remove key="umbracoDebugMode" />
        <remove key="umbracoProfileUrl" />
        <remove key="umbracoDbDSN" />
        <remove key="umbracoContentXML" />
        <remove key="umbracoConfigurationStatus" />
    </appSettings>
    <system.web>
        <httpModules>
            <remove name="UrlRewriteModule" />
            <remove name="umbracoRequestModule" />
            <remove name="viewstateMoverModule" />
            <remove name="umbracoBaseRequestModule" />
            <remove name="ScriptModule" />
        </httpModules>
        <httpHandlers>
            <remove verb="*" path="umbraco/channels.aspx" />
            <remove verb="*" path="umbraco/channels/word.aspx"/>
        </httpHandlers>
    </system.web>
</configuration>



Sorry if this is a repost but my last one hasnt shown up on the "Extending Umbraco" Sub Forum
rorythecheese
Posted: Thursday, March 27, 2008 3:42:38 PM

Rank: Newbie

Joined: 2/15/2008
Posts: 16
Location: London, England
Can anyone see this. It isnt showing up for me in the "extending umbraco" forum.
mortenbock
Posted: Thursday, March 27, 2008 5:20:35 PM

Rank: Addict

Joined: 7/19/2006
Posts: 655
Location: Århus, Denmark
For some reason it is showing up on the last page of the forum... this happens to some posts, for some very odd reason....

Morten Bock - Level 2 certified - My danish blog with a few english posts | CodeGarden on Facebook
rorythecheese
Posted: Thursday, March 27, 2008 5:51:54 PM

Rank: Newbie

Joined: 2/15/2008
Posts: 16
Location: London, England
hmm th\at is odd.. is there anyway to bump them to the top?

bit more information on the XSL issue - ive got it so that the transforming XSLT is in the main /xslt/ folder and now shows up in the admin area under developer-> XLST Files. but using umbraco.library:NiceUrl still doesnt send the url to my external XML. Infact i get an error in the resulting xml as follows.



Code:
Server Error in '/xml' Application.
--------------------------------------------------------------------------------

Prefix 'umbraco.library' is not defined.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Xml.Xsl.XsltException: Prefix 'umbraco.library' is not defined.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. 

Stack Trace:


[XsltException: Prefix 'umbraco.library' is not defined.]
   System.Xml.Xsl.XsltOld.InputScopeManager.ResolveNonEmptyPrefix(String prefix) +305942
   System.Xml.Xsl.XsltOld.XsltCompileContext.LookupNamespace(String prefix) +43
   System.Xml.Xsl.XsltOld.XsltCompileContext.ResolveFunction(String prefix, String name, XPathResultType[] argTypes) +85
   MS.Internal.Xml.XPath.FunctionQuery.SetXsltContext(XsltContext context) +261
   MS.Internal.Xml.XPath.StringFunctions.SetXsltContext(XsltContext context) +41
   System.Xml.Xsl.XsltOld.Processor.GetValueQuery(Int32 key, XsltCompileContext context) +148
   System.Xml.Xsl.XsltOld.AvtEvent.Output(Processor processor, ActionFrame frame) +19
   System.Xml.Xsl.XsltOld.CopyCodeAction.Execute(Processor processor, ActionFrame frame) +106
   System.Xml.Xsl.XsltOld.ActionFrame.Execute(Processor processor) +21
   System.Xml.Xsl.XsltOld.Processor.Execute() +106
   System.Xml.Xsl.XsltOld.Processor.Execute(TextWriter writer) +176
   System.Xml.Xsl.XslTransform.Transform(XPathNavigator input, XsltArgumentList args, TextWriter output, XmlResolver resolver) +147
   System.Xml.Xsl.XslTransform.Transform(IXPathNavigable input, XsltArgumentList args, TextWriter output, XmlResolver resolver) +45
   System.Web.UI.WebControls.Xml.Render(HtmlTextWriter output) +129
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +25
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +2116190
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +22
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +199
   System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +20
   System.Web.UI.Page.Render(HtmlTextWriter writer) +26
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +25
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +2116190
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +22
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2558


imayat12
Posted: Thursday, March 27, 2008 6:12:24 PM

Rank: Fanatic

Joined: 7/19/2006
Posts: 407
Location: Preston, UK
Hi Rory,

I am a bit confused regarding what you are trying to do, however I have in my events calendar control in .net code done an xsl transformation outside umbraco but passed into the xslt the umbraco library extension object and thus was able to use niceurl in that xsl which was not even in umbraco xslt dir.

My code looks this

Code:
//Create an XsltArgumentList.
            XsltArgumentList xslArg = new XsltArgumentList();         
            //pass in umbraco library to beef up the xsl so we can use umbraco functions
            umbraco.library lib = new library();
            xslArg.AddExtensionObject("urn:umbraco.library", lib);
            xslArg.AddParam("startID","",eventsStartNode);
            xsltrans.Load(this.Context.Server.MapPath(resourcePath + "events.xslt"));            
            resolver.Credentials = System.Net.CredentialCache.DefaultCredentials;            
            xsltrans.Transform(node.CreateNavigator().Select(".").Current,xslArg,writer2,resolver);



Is this what you are looking to do?

Regards

Ismail

Level 2 certified. If it aint broke dont fix.
rorythecheese
Posted: Monday, March 31, 2008 1:03:47 PM

Rank: Newbie

Joined: 2/15/2008
Posts: 16
Location: London, England
Hey, i think this is what we're trying to do. Thanks for your help Ismail.
rorythecheese
Posted: Tuesday, April 01, 2008 2:15:20 PM

Rank: Newbie

Joined: 2/15/2008
Posts: 16
Location: London, England
Actually, imayat12 how did you load in the umbraco.library assembly because it cant find it?

Im getting this compiler error

CS0246: The type or namespace name 'umbraco' could not be found (are you missing a using directive or an assembly reference?)

Cheers.
imayat12
Posted: Thursday, April 03, 2008 8:19:13 AM

Rank: Fanatic

Joined: 7/19/2006
Posts: 407
Location: Preston, UK
Rory,

I have the following references in my project

umbraco
businesslogic
cms
interfaces

and i have the following umbraco using statements:


Code:

using umbraco;
using umbraco.cms.businesslogic;
using umbraco.cms.businesslogic.web;
using umbraco.BusinessLogic;


Regards

Ismail

Level 2 certified. If it aint broke dont fix.
Users browsing this topic
Guest


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.