Copied to clipboard

Flag this post as spam?

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


  • sdfsfm 70 posts 94 karma points
    Aug 23, 2010 @ 14:34
    sdfsfm
    0

    get a link using inline xslt

    Hi, I'm trying to show a link using inline xslt in a template i have using the below

    <umbraco:Item runat="server" field="productDownload"
              xslt="concat('&lt;a href=&quot;', umbraco.library:GetMedia({0},'true')/.productDownload, '&quot; /&gt;')"
    XsltDisableEscaping="true" />

    But is not showing up. I'm using 4.5.1 and trying to generate a link to download aproduct pdf.

  • Comment author was deleted

    Aug 23, 2010 @ 14:42

    try

    umbraco.library:GetMedia({0},'false')//umbracoFile
  • sdfsfm 70 posts 94 karma points
    Aug 23, 2010 @ 14:54
    sdfsfm
    0

    Hi Tim,

    so basicall this:

    <umbraco:Item runat="server" field="productDownload"
              xslt="concat('&lt;a href=&quot;', umbraco.library:GetMedia({0},'false')//productDownload, '&quot; /&gt;')"
    XsltDisableEscaping="true" />

    It generates the a tag but not the link :(

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    Aug 23, 2010 @ 15:04
    Matt Brailsford
    0

    Hi Ivor,

    It needs to be specificaly umbracoFile so

    <umbraco:Item runat="server" field="productDownload"
              xslt="concat('&lt;a href=&quot;', umbraco.library:GetMedia({0},'false')//umbracoFile, '&quot; /&gt;')"
    XsltDisableEscaping="true" />


    Also, I'm sure you are aware, this won't actualy display anthing as you are generating a self closing a tag, but it should at least get you the correct URL. You may be better of with something like.

    <a href='<umbraco:Item runat="server" field="productDownload" xslt="umbraco.library:GetMedia({0},'false')/umbracoFile" />'>Your Link Text Here</a>

    Matt

  • Comment author was deleted

    Aug 23, 2010 @ 15:05

    did you try ?

     

    umbraco.library:GetMedia({0},'false')//umbracoFile

    Since the getmedia call will return some xml and in that xml is an umbracoFile node that contains the path to the file

  • sdfsfm 70 posts 94 karma points
    Aug 23, 2010 @ 15:24
    sdfsfm
    0

    @Matt Ahh i get it, I thought  //umbracoFile was suppose to be my field name for the download. No wonder it wasn't working. i did noticed it was self closing and had changed it after I did the post. Thanks.

    @Tim my bad, it works I just didn't realise //umbracoFile was actually needed. THanks for the help

     

  • Thomas Egebrand Gram 63 posts 138 karma points
    May 19, 2011 @ 00:32
    Thomas Egebrand Gram
    0

    Oh my - greatly appreciated! :)

    Virtual high-five! Been spending hours looking for something like this.

Please Sign in or register to post replies

Write your reply to:

Draft