Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at

  • Ralph van Vugt 57 posts 101 karma points
    Apr 08, 2010 @ 14:10
    Ralph van Vugt

    Listing images from a user-selected mediafolder

    I want to create a simple gallery. The user uploads photo's to a folder in the media section. He then creates a page and selects the nodeID with the mediapicker (ccGalleryFolder). This is the XSLT, but it doesn't work. Can someone explain me the mistake(s) I've made?

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]>
        xmlns:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets" 
        exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets ">
    <xsl:output method="xml" omit-xml-declaration="yes"/>
    <xsl:param name="currentPage"/>
    <xsl:template match="/">
    <xsl:variable name="imageFolder" select="./data[@alias = 'ccGalleryFolder']" />
        <xsl:variable name="imageFolderContents" select="umbraco.library:GetMedia($imageFolder/node/@id, 'true')"/>
                        <xsl:for-each select="$imageFolderContents/node [@nodeTypeAlias='Image']">
                        <div class="referenties">
                            <xsl:if test="string(current()/data [@alias='umbracoFile']) != ''">
                                <img alt="{current()/@nodeName}">
                                    <xsl:attribute name="src">
                                        <xsl:value-of select="./data [@alias = 'umbracoFile']" />



  • Chriztian Steinmeier 2798 posts 8788 karma points MVP 8x admin c-trib
    Apr 08, 2010 @ 14:50
    Chriztian Steinmeier

    Hi Raph,

    The call to GetMedia() should just use the $imageFolder value directly (it's the ID of the folder). Also, you should use true() or 1 as the second parameter:

    <xsl:variable name="imageFolderContents" select="umbraco.library:GetMedia($imageFolder, true())"/>


  • Ralph van Vugt 57 posts 101 karma points
    Apr 09, 2010 @ 10:00
    Ralph van Vugt

    Hi Chriztian,

    Thanks for the help. It still doesn't work, but I think there is a problem with the rest of the xslt, so I will try to fix that first.



  • Ralph van Vugt 57 posts 101 karma points
    May 17, 2010 @ 11:24
    Ralph van Vugt

    Took me a while, but figured it out. The problem was I didn't know how to pass a nodeID to a macro which is, in fact, pretty easy.

    <umbraco:Macro imageFolder="[#ccGalleryFolder]" Alias="Gallery" runat="server"></umbraco:Macro>

    ccGallery is the alias of a mediaPicker in the DocType which selects the imagefolder in the Mediasection. 

    Works like a charm.


Please Sign in or register to post replies

Write your reply to: