I cannnot tell you the exact parsing error because i use redirect and i always have to check the checkbox above the xslt to get xslt working with redirects.
The parsing error that you get might be because you are creating a variable called url, but you already have declared a variable with that name ealier in your code. And you can't have two variables with the same name.
Yeah, it's good to know that you can't overwrite a variable like you can in eg. JavaScript etc. But you can have the same variable name if you're inside different scopes in your XSLT code. But for now it's just great that you got things working :)
GetMedia XSLT Problem
Hello,
I cant get the URL from my selected get media Item:
This is my xslt:
This does not work. the variable media includes the ID (i tested this).
How can i get the URL of the "media" id?
I am using umbraco 4.5.2
umbraco.library:GetMedia($media, 0)/umbracoFile
<xsl:value-of select="umbraco.library:GetMedia($media, 0)" /> might be useful for you to see what it actaully returns..
If i use your script i also get an xslt parsing error. Perhaps the problem is that one of my items does not have any homeBGImage?
Hi Dominik
If I remember correctly there is a bug with GetMedia in 4.5.2.
What does the returned XML look like if you make a copy-of? Like
<textarea>
<xsl:copy-of select="$media" />
</textarea>
It should be fairly easy to fix this afterall but if I remember correctly you need to make a minor fix in the XSLT match.
/Jan
What is the parsing error you receive by the way?
/Jan
Hi Jan,
I cannnot tell you the exact parsing error because i use redirect and i always have to check the checkbox above the xslt to get xslt working with redirects.
I read this is an error in Umbraco.
I will try your solution and will come back
Hi Dominik
If you're absolutely sure that the media-variable contains a media-node id you should be able to get the path to the file like this:
The parsing error that you get might be because you are creating a variable called url, but you already have declared a variable with that name ealier in your code. And you can't have two variables with the same name.
/Kim A
Ok now i use a choose statement and it works.
I didnt know that it is not possible to overwrite a variable (like I can do in some other languages).
Now it works.
Thanks
Great to hear Dominik!
Yeah, it's good to know that you can't overwrite a variable like you can in eg. JavaScript etc. But you can have the same variable name if you're inside different scopes in your XSLT code. But for now it's just great that you got things working :)
/Kim A
is working on a reply...