Copied to clipboard

Flag this post as spam?

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


  • andelm 1 post 21 karma points
    Apr 14, 2011 @ 20:20
    andelm
    0

    Pass parameter to GetMedia

    I want to show an image that has been selected from a Media Picker. I have created an XSLT and a Macro.

    I want to reuse the macro on several pages so I need to pass a parameter to my Macro with the property-id of the Media Picker. 

    Something like this: (except from that $currentPage/$imageName is not working) 

     

    <xsl:param name="currentPage"/>
    <xsl:param name="imageName" select="macro/ImageName" />
        
    <xsl:template match="/">
         
      <xsl:variable name="media" select="umbraco.library:GetMedia($currentPage/$imageName, 0)" />
         
    <xsl:if test="$media">
            <img src="{$media/umbracoFile}" />
    </xsl:if>

    </xsl:template>

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Apr 14, 2011 @ 20:32
    Tom Fulton
    0

    Hi,

    Try using this instead:

     <xsl:variable name="media" select="umbraco.library:GetMedia($currentPage/* [local-name() = $imageName], 0)" />

    -Tom

  • andelm 1 post 21 karma points
    Apr 14, 2011 @ 20:41
    andelm
    0

    Hi, 

    It works! Thank you! You saved me a lot of time and frustration :-)

Please Sign in or register to post replies

Write your reply to:

Draft