Copied to clipboard

Flag this post as spam?

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


  • Dinovo 40 posts 59 karma points
    Dec 10, 2009 @ 23:18
    Dinovo
    0

    New getmedia problem?

    Having looked through the forum for the possible solution to my problem, but no luck.

     

    Faily simple xslt file that should display a image selected with 'Improved Mediapicker';

    <xsl:for-each select="$currentPage/node [string(data [@alias='umbracoNaviHide']) != '1' and @template = '1053']">
    <xsl:variable name="catImage" select="data[@alias='catImage']" />
    <xsl:choose>
    <xsl:when test="$catImage != ''">
    <img src="{umbraco.library:GetMedia($catImage, 'false')/data [@alias = 'umbracoFile']}" />
    </xsl:when>
    <xsl:otherwise>
    <img src="/images/no_image.gif" alt="{@nodeName}" />
    </xsl:otherwise>
    </xsl:choose>
    </xsl:for-each>

    No errors in the editor when saving but the output is failing with; Error parsing XSLT file: \xslt\ProductList.xsl

    Any ideas what i am doing wrong?

  • Chriztian Steinmeier 2800 posts 8791 karma points MVP 8x admin c-trib
    Dec 10, 2009 @ 23:22
    Chriztian Steinmeier
    0

    Hi Dinovo

    Try to cast the $catImage to a number in the call to GetMedia:

    <img src="{umbraco.library:GetMedia(number($catImage), 'false')/data [@alias = 'umbracoFile']}" /> 

    The reason it doesn't fail in the editor is probably because it ends up in the "otherwise" branch.

    /Chriztian

  • Dinovo 40 posts 59 karma points
    Dec 10, 2009 @ 23:28
    Dinovo
    0

    Hi Chriztian

    This fails;

    <img src="{umbraco.library:GetMedia(number($catImage), 'false')/data [@alias = 'umbracoFile']}" />

    This works;

    <img src="{umbraco.library:GetMedia(number(1116), 'false')/data [@alias = 'umbracoFile']}" />

    Haveing some trouble seeing whats going on there. :-/

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Dec 10, 2009 @ 23:30
    Lee Kelleher
    1

    Hi Dinovo,

    It might sound like I've been pimping one of my blog posts quite a lot today ... but take a quick read, it should give you some insight into using GetMedia in XSLT.

    http://blog.leekelleher.com/2009/11/30/how-to-use-umbraco-library-getmedia-in-xslt/

    Cheers, Lee.

  • Dinovo 40 posts 59 karma points
    Dec 10, 2009 @ 23:37
    Dinovo
    0

    Hi Lee,

    Thank you very much - that did the trick :)

Please Sign in or register to post replies

Write your reply to:

Draft