I'm still pretty new to xslt and i'm having some trouble implementing a gallery funktion on my site. My thought is that i want to use a media picker to select a folder in my media libary and then the contents of that libary are displayed as a gallery. I've found a lot of different solutions using the forum and google but i simply can't get it to work. Here is what i have tried. I'm running Umbraco 4.5
Hope someone has a solution.
Best regards
Steffen
here is what i have so far. I have of course set up the input parameter on the macro and parsed it from the template.
I think the issue with your code example is that the samples you have seen around the forums etc. are based on the old XML schema. From v4.5 the schema has changed. It's possible to run the legacy schema though. But I don't see any reason for that.
The attributes on the data elements are made into xml elements with the new schema. So to get the value from "umbracoFile" you would need to just select the element like this <xsl:value-of select="umbracoFile" />.
Another thing - in your select statement in the loop <xsl:for-each select="umbraco.library:GetMedia($MediaNodeId, 'false')/node"> you should use a boolean. It actually only accepts either 0 or 1. If you pass 0 as an argument you only get the actual image and if you pass 1 you get all images. When you insert text it equals true, so even though you have written false it actually returns true. If you put in "Test" it would also return true. It's been a comon mistake, which many in the community has probably made. Inclduing myself :)
Finally you need to make sure that the macro parameter actually returns a folder id. With that in place let's look at some code.
To see the XML you actually get returned you can make a textarea, in wich you have a copy-of
Here is a working example using ImageGen to create resizes, and a lightbox script to create popups with larger size images. It uses a page property (galleryalbum - a mediapicker that i use to select a folder) to generate a list of thumbnails and then link to the larger version
Could you provide us with some more details on you problem? Does the xslt-file fail, or is anything being generated at all? Which version of Umbraco are you using? Have you installed the ImageGen package?
Another thing worth trying is to write out the $images variable to see if it's empty or what it contains. Right under the <xsl:variable name="images"..../> could you try inserting this:
XSLT image gallery
Hi everybody
I'm still pretty new to xslt and i'm having some trouble implementing a gallery funktion on my site. My thought is that i want to use a media picker to select a folder in my media libary and then the contents of that libary are displayed as a gallery. I've found a lot of different solutions using the forum and google but i simply can't get it to work. Here is what i have tried. I'm running Umbraco 4.5
Hope someone has a solution.
Best regards
Steffen
here is what i have so far. I have of course set up the input parameter on the macro and parsed it from the template.
Hi Steffen
I think the issue with your code example is that the samples you have seen around the forums etc. are based on the old XML schema. From v4.5 the schema has changed. It's possible to run the legacy schema though. But I don't see any reason for that.
The attributes on the data elements are made into xml elements with the new schema. So to get the value from "umbracoFile" you would need to just select the element like this <xsl:value-of select="umbracoFile" />.
Another thing - in your select statement in the loop <xsl:for-each select="umbraco.library:GetMedia($MediaNodeId, 'false')/node"> you should use a boolean. It actually only accepts either 0 or 1. If you pass 0 as an argument you only get the actual image and if you pass 1 you get all images. When you insert text it equals true, so even though you have written false it actually returns true. If you put in "Test" it would also return true. It's been a comon mistake, which many in the community has probably made. Inclduing myself :)
Finally you need to make sure that the macro parameter actually returns a folder id. With that in place let's look at some code.
To see the XML you actually get returned you can make a textarea, in wich you have a copy-of
<textarea>
<xsl:copy-of select="$MediaNodeId" />
</textarea>
I hope these pointers can help you out.
/Jan
Here is a working example using ImageGen to create resizes, and a lightbox script to create popups with larger size images. It uses a page property (galleryalbum - a mediapicker that i use to select a folder) to generate a list of thumbnails and then link to the larger version
Thank you both!
It got it to work with rik's code, but nice to know that the schema changed and thats why it did not work.
Hi Rik,
I used your xslt to generate a page gallery but It doesn't display the images.
Sherry
Hi Sherry.
Could you provide us with some more details on you problem? Does the xslt-file fail, or is anything being generated at all? Which version of Umbraco are you using? Have you installed the ImageGen package?
Another thing worth trying is to write out the $images variable to see if it's empty or what it contains. Right under the <xsl:variable name="images"..../> could you try inserting this:
This will print out the XML content from the $images. Does it contain anything?
/Kim A
is working on a reply...