I had a xslt function that I was using in the old syntax. It was basically a gallery and it worked great. Now, I upgraded and am using the new syntax. Some things are working properly, but I'm having a problem with a little piece of code.
Below is an example of a piece of code that grabs $mediaFolderID, which is the id of a media folder - 1109 for example, and executes a command for every folder underneath the $mediaFolderID.
From what I gather, the new code should do the same thing, but it isn't. It doesn't seem to recognize anything and doesn't seem to be finding any folders under this media id.
Hmm..I tested here and it seems to work. Try writing out the results of GetMedia into a textarea with copy-of, so you can see the XML that gets generated:
Still not working, sadly. I appreciate all the suggestions. Is it possible that a faulty install might cause issues? I'm not sure what else it could be.
That's odd, it is working for me. Actually....are you on 4.5.2 or 4.5.0 or 4.5.1? I think there were some changes to the media XML structure between them.
Also, are you getting anything in your textarea after adding the '0'? If not, try removing /Folder and paste the results here
In 4.5.0 or .1 (can't remember which one), it might be something like
.../*/Folder instead of .../Folder...but you should be able to see what's
going on once you get the results in the textarea
Are you sure the new installtion is using the new XML schema? Have you tried to republish the specified folder and it's children? Try to republish all nodes under the "content" section.
Have you tried recycling the app pool or just reset the IIS?
Are you having other problems with the installation?
Yes, it's actually a bit frustrating. Maybe that would be a good suggestion for v5 - there is a post about it somewhere in the forum. It's worth suggesting if someone has not done so already.
Happy you got it all solved - One can be so frustrated sometimes :-)
I'm asuming you want to fetch all the images in the specified folder. To to so, if i'm not mistaken, you'll actually need to
write either umbraco.library:GetMedia(1096,1), which returns true and then returns all the subnodes. I think that you can also use umbraco.library:GetMedia(1096,true()) - if you pass 0 as a string, like '0', it's interpreted as "true". If you just pass 0 it'll return false and you'll only get the XML of the folder.
GetMedia New XSLT Syntax Issues
I had a xslt function that I was using in the old syntax. It was basically a gallery and it worked great. Now, I upgraded and am using the new syntax. Some things are working properly, but I'm having a problem with a little piece of code.
Below is an example of a piece of code that grabs $mediaFolderID, which is the id of a media folder - 1109 for example, and executes a command for every folder underneath the $mediaFolderID.
old:
new:
From what I gather, the new code should do the same thing, but it isn't. It doesn't seem to recognize anything and doesn't seem to be finding any folders under this media id.
Any suggestions?
Thanks so much!
I don't think the Media area uses @isDoc - try removing that and I believe it will work
If I remove the @isDoc, I get the same issue.
I have also tried using the direct id, to remove extra variables that could cause issues. Below are some other things I have tried.
Hmm..I tested here and it seems to work. Try writing out the results of GetMedia into a textarea with copy-of, so you can see the XML that gets generated:
Still not getting anything. I've simplified my code for the purpose of the forum. Here is all of it.
Add quotes around the second parameter in GetMedia and you should be good
Still not working, sadly. I appreciate all the suggestions. Is it possible that a faulty install might cause issues? I'm not sure what else it could be.
That's odd, it is working for me. Actually....are you on 4.5.2 or 4.5.0 or 4.5.1? I think there were some changes to the media XML structure between them.
Also, are you getting anything in your textarea after adding the '0'? If not, try removing /Folder and paste the results here
In 4.5.0 or .1 (can't remember which one), it might be something like .../*/Folder instead of .../Folder...but you should be able to see what's going on once you get the results in the textarea
I'm in 4.5.2.
I tried using '0' - nothing. I tried removing "/Folder" and still nothing. Here is what I have currently, and I'm not getting anything.
Hi Kaifish
Are you sure the new installtion is using the new XML schema? Have you tried to republish the specified folder and it's children? Try to republish all nodes under the "content" section.
Have you tried recycling the app pool or just reset the IIS?
Are you having other problems with the installation?
/Jan
Wow, I can't believe that was it. I had to republish everything in the media folder. (Manually sadly since there isn't a master republish).
Thank you so much! Very helpful!
Also, sorry Tom that we had to go through all of that and that was what the problem was..
Yes, it's actually a bit frustrating. Maybe that would be a good suggestion for v5 - there is a post about it somewhere in the forum. It's worth suggesting if someone has not done so already.
Happy you got it all solved - One can be so frustrated sometimes :-)
/Jan
btw...
I'm asuming you want to fetch all the images in the specified folder. To to so, if i'm not mistaken, you'll actually need to
write either umbraco.library:GetMedia(1096,1), which returns true and then returns all the subnodes. I think that you can also use umbraco.library:GetMedia(1096,true()) - if you pass 0 as a string, like '0', it's interpreted as "true". If you just pass 0 it'll return false and you'll only get the XML of the folder.
/Jan
You can run this:
to re-publish all nodes incl. media
>Tommy
Thanks, I will try that :)
Great tip Tommy - #H5YR :-)
Jan to the rescue! Also thanks for clarifying the '0' thing
is working on a reply...