How are you using the $sourceURL variable? Have you checked that it gets the URL correct?
If you're using GetXmlDocumentByUrl() to fetch its contents, have you checked that you can fetch another URL (i.e., can you fetch another RSS feed successfully?)
At the moment, the only solution I have is to pass a number instead, and inside the macro to have 3 big IF statements that check for that number and roll different pieces of code according to each feed source.
Note that it uses & instead of a single & - it's required in code, but actually little of a grey area when used like this in a textbox where you just need to paste a URL...
It may very well be the issue, because of the way the string is handed to the C# extension...
So I just tried this and something hit me: Where do you get the error? In the backoffice or on the website?
My test worked right out of the box, but I do of course get that exact "URI is empty" error when saving the XSLT (which is expected because the $sourceURL variable at that point is empty.)
Should I try and save the XSLT outside of the backoffice?
Yes, you can do that too - I almost always do that, actually.
Another (and probably better) way of doing it, is to do a check inside the XSLT before calling the extension, because it throws exceptions when something is wrong... perhaps something like this:
Parameter passing to macro
Hi,
I am trying to pass a parameter of type text called sourceLink to a macro. This is how I do it:
And in the XSLT I tried both:
and
yet I still get nothing.
Is there anything I am missing?
Hi Alexandru,
Umbraco creates an XML document that looks like this, for the Macro to use:
- So you can see the attribute from the
<umbraco:Macro>
tag is converted to an element - so you don't use the @ sign:/Chriztian
Okay but I get the same error ...
Okay,
Lets get the
<macro>
output out, to see if it's as expected - put this in your XSLT file:Do you get the
<sourceLink>
element - how does it look?/Chriztian
Just like this:
And yes, I did create the macro for the parameter:
Any thoughts?
I'm using Umbraco 6.1.5
bump
Hi Alexandru,
How are you using the
$sourceURL
variable? Have you checked that it gets the URL correct?If you're using
GetXmlDocumentByUrl()
to fetch its contents, have you checked that you can fetch another URL (i.e., can you fetch another RSS feed successfully?)/Chriztian
Hi,
The problem is when I use the variable inside the GetXmlDocumentByUrl()...
Yes, I can successfully fetch another RSS feed.
I did this to see if the parameter is successfully sent:
And it printed the link with no problems.
However, when I put that in GetXmlDocumentByUrl....it complains
I have tried to use it two ways:
like this:
returns this:
and like this
returns this:
At the moment, the only solution I have is to pass a number instead, and inside the macro to have 3 big IF statements that check for that number and roll different pieces of code according to each feed source.
Hi Alexandru - I have a hunch as to what is going on...
Can you try specifying the URL in the macro parameter using escaped ampersands like this:
http://hsfo.dk/section/artikler/?template=RSS&mime=xml&profile=1196
Note that it uses & instead of a single & - it's required in code, but actually little of a grey area when used like this in a textbox where you just need to paste a URL...
It may very well be the issue, because of the way the string is handed to the C# extension...
/Chriztian
I have tried it. It's not that :(
Oh - and should probably use the caching version of the
GetXmlDocumentByUrl()
extension:/Chriztian
Very strange indeed, then... :(
I'd really like to help you fix this but I'm a little out of ideas now...
/Chriztian
No problem, It's good that I actually found a way around it.... I hope other people won't have to run into this...
Thanks for your support!
Hi again,
So I just tried this and something hit me: Where do you get the error? In the backoffice or on the website?
My test worked right out of the box, but I do of course get that exact "URI is empty" error when saving the XSLT (which is expected because the
$sourceURL
variable at that point is empty.)/Chriztian
Yes, I get the error in the backoffice when I try to save.
Should I try and save the XSLT outside of the backoffice?
Alright then - then if you click the "Skip errors" checkbox and Save, it should actually work... (?)
/Chriztian
Hell, it actually does!
Finally, thank God!
Cheers man!!!
Yes, you can do that too - I almost always do that, actually.
Another (and probably better) way of doing it, is to do a check inside the XSLT before calling the extension, because it throws exceptions when something is wrong... perhaps something like this:
/Chriztian
is working on a reply...