New Package - Related Media

Based on the related links datatype that’s been added to umbraco v4.

This is a similar datatype but for selecting media, so a multiple media picker.


You can add media by setting a caption and selecting a media item. Very similar to the related links.

The package will also install a xslt and marco that shows how to use xslt to display the stored media.

<?xml version=”1.0″ encoding=”UTF-8″?>
<!DOCTYPE xsl:stylesheet [
  &lt;!ENTITY nbsp “&#x00A0;”>
    exclude-result-prefixes=”msxml umbraco.library”>
  <xsl:output method=”xml” omit-xml-declaration=”yes” />
  <xsl:param name=”currentPage”/>
  <!– Input the related links property alias here –>
  <xsl:variable name=”propertyAlias” select=”string(’relatedmedia’)”/>
  <xsl:template match=”/”>
    <!– The fun starts here –>
      <xsl:for-each select=”$currentPage/data [@alias = $propertyAlias]/media/item”>
          <xsl:element name=”a”>
                <xsl:attribute name=”href”>
                  <xsl:value-of select=”umbraco.library:GetMedia(./@id,’false’)/data [@alias = ‘umbracoFile’]”/>
            <xsl:value-of select=”./@title”/>


Related Media Package: download

10 Comments so far

  1. David Conlisk on April 8th, 2009

    Nice work - very useful. How do you have the time to create all of these while running a business? Perhaps you could create a package that allows me to have more time to release packages while keeping clients happy too :)

  2. Dan on April 8th, 2009

    Like you read my mind, I needed something like this just now!


  3. Nik on May 22nd, 2009

    Great work (as usual)!

    Have you considered merging it with NĂ–RD’s multiple file uploader or any other upload function (could even be you zip uploader)?

    If you’re willing to share some code I’d be happy to give it a try! ;)

  4. Si on June 18th, 2009

    Sounds like exactly what I need.

    However when I add the package on a new Umbraco installation I’m not getting the datatype show up. The macro and XSLT are showing though. Any help you can give?

  5. Ben on June 19th, 2009

    Hey Si,
    Go to Data Types in Developer, create a new DataType and choose Related Media as the render control. You should then be good to go :)

  6. Brent on March 15th, 2011

    I was looking at doing this myself, but this was a huge help. I did have a problem using it with Umbraco 4.6 (probably because of the XML schema changes) so I had to modify the XSLT as follows:

  7. IAMMRBONGO on April 12th, 2011

    Hi all,
    Having a bit of trouble getting this to work umbraco 4.5 after upgrading. Any advice? I can’t see any compatibility information anywhere.

  8. Andy Wilde on May 31st, 2011

    I’m having a problem viewing the content in v4.5. The xml is being stored as the list of items I have selected is shown in the editor but the only content I get rendered is ”.

    I have reinstalled and checked the alias name in the XSLT several times but still no rendered content, any help would be greatly appreciated.

  9. Wendy on August 19th, 2011

    I am trying to implement this is Umbraco 4.5 but keep getting an empty . I replaced the xslt as Brent suggested here ( but it still won’t work. Any help would be appreciated.

  10. Anterec Software Development Team on November 7th, 2011

    @Wendy - we’ve double checked our code and it seems to be fine. The Umbraco XML schema changed from version 4.5, so older XSLT files can stop working.

    Take a look at our post at for our 4.5 (and higher) version of the XSLT, but remember that you still need to perform the other configuration steps as described here.

Leave a Reply