Copied to clipboard

Flag this post as spam?

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


  • Bent Holz 100 posts 273 karma points
    Nov 21, 2013 @ 14:24
    Bent Holz
    0

    Media picker File name not URL

    I have added a media picker item to my Document Template and am now trying with xslt to get it to render the file name (ex.: "MyUploadedPdf.pdf") and not the url of the file instead if my link text "Download/se PDF"  but no luck... any ideas?

    My xslt for now:

    <xsl:if test="uploadedDocument !=''">
    <p><a href="{umbraco.library:GetMedia(uploadedDocument, false())/umbracoFile}" target="_blank">Download/se PDF</a></p>
    </xsl:if>
    Any help out there?!?...
    Cheers Crawn

     

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Nov 21, 2013 @ 14:34
    Dennis Aaen
    0

    Hi Crawn,

    Try this one:

    <xsl:if test="$currentPage/uploadedDocument !=''">
     <p><a href="{umbraco.library:GetMedia($currentPage/uploadedDocument, false())/umbracoFile}" target="_blank">Download/se PDF</a></p>
    </xsl:if>

    Hope this helps,

    /Dennis

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Nov 21, 2013 @ 14:42
    Dennis Aaen
    0

    Hi Crawn,

    Okay so you want the node name in your link and not the url to the file right?

    Try this one:

    <xsl:if test="$currentPage/uploadedDocument !=''">
     <p><a href="{umbraco.library:GetMedia($currentPage/uploadedDocument, false)/@nodeName}" target="_blank">Download/se PDF</a></p>
    </xsl:if>

    /Dennis

  • Bent Holz 100 posts 273 karma points
    Nov 21, 2013 @ 15:50
    Bent Holz
    0

    Hi Dennis...

    i'm trying to replace the "Download/se PDF" with the file name (ex. mypdf) without file extention (.pdf) and not the URL (media/45120/mypdf.pdf)...

    So the end result is: <a href="media/45120/mypdf.pdf">mypdf</a>

    Cheers

    /Crawn

     

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Nov 21, 2013 @ 16:02
    Dennis Aaen
    0

    Hi Crawn,

    Okay then try this one:

    <xsl:if test="$currentPage/uploadedDocument !=''">
        <p>
            <a href="{umbraco.library:GetMedia($currentPage/uploadedDocument, false())/umbracoFile}" target="_blank">
                <xsl:value-of select="umbraco.library:GetMedia($currentPage/uploadedDocument, false)/@nodeName}"/>
            </a>
        </p>
    </xsl:if>

    /Dennis

  • Bent Holz 100 posts 273 karma points
    Nov 21, 2013 @ 16:12
    Bent Holz
    0

    Hi Dennis

    If i remove the "}" after @nodeName in your code i just get "Error parsing XSLT file: \xslt\Listfiles.xslt"

    <xsl:value-ofselect="umbraco.library:GetMedia($currentPage/uploadedDocument, false)/@nodeName}"/>

    But as far as i can see this should do it :(

    Cheers

    /Crawn

  • Bent Holz 100 posts 273 karma points
    Nov 21, 2013 @ 16:14
    Bent Holz
    0

    Hi again

    ...but the again   @nodeName wont that just output the name of the page?

    Cheers

    /Crawn

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Nov 21, 2013 @ 19:33
    Dennis Aaen
    0

    Hi Crawn,

    This code should work just file assuming that you not in a for-each loop.

    <xsl:if test="$currentPage/uploadedDocument !=''">
        <p>
            <a href="{umbraco.library:GetMedia($currentPage/uploadedDocument, false())/umbracoFile}" target="_blank">
                <xsl:value-of select="umbraco.library:GetMedia($currentPage/uploadedDocument, false)/@nodeName"/>
            </a>
        </p>
    </xsl:if>

    The @nodeName would return the name the file when you created it in the media library. Not the name of the PDF file, but the name of the item in the media library. e.g In the case the @nodeName will returns My PDF.

    I hope this will work for you and helps you.

    /Dennis

  • Claushingebjerg 939 posts 2574 karma points
    Nov 22, 2013 @ 15:40
    Claushingebjerg
    2

    How about

    <xsl:value-ofselect="umbraco.library:GetMedia($currentPage/uploadedDocument, false)/@urlName}"/>.<xsl:value-ofselect="umbraco.library:GetMedia($currentPage/uploadedDocument, false)/umbracoExtension}"/>
  • Claushingebjerg 939 posts 2574 karma points
    Nov 22, 2013 @ 15:41
    Claushingebjerg
    0

    with a space between value-of and select...

     

Please Sign in or register to post replies

Write your reply to:

Draft