Copied to clipboard

Flag this post as spam?

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


  • bayshield 50 posts 65 karma points
    Oct 29, 2009 @ 13:11
    bayshield
    0

    NiceURL inline xslt

    Hi,

    I am amost embarassed to ask as I know the answer is going to be simple, however can someone please tell me what is wrong with the line below.

    <a href='<umbraco:Item runat="server" xslt="umbraco.library:NiceUrl($currentPage/data[@alias=MoreInfoLink])" />' >More info</a>

     

    Thanks

    Aaron

  • Chriztian Steinmeier 2800 posts 8790 karma points MVP 8x admin c-trib
    Oct 29, 2009 @ 13:22
    Chriztian Steinmeier
    0

    This is basic XML - you can't use elements inside attributes - you need to use what's called an Attribute Value Template (~ curly braces):

    <a href="{umbraco.library:NiceUrl($currentPage/data[@alias = 'MoreInfoLink'])}">More info</a>

    /Chriztian :-)

  • Richard Soeteman 4046 posts 12899 karma points MVP 2x
    Oct 29, 2009 @ 13:24
    Richard Soeteman
    2

    Hi Aaron,

    Check out this post for a nice example. Try this <a href='<umbraco:Item runat="server" field="MoreInfoLink" xslt="umbraco.library:NiceUrl({0})" />' >More info</a>

    The value of MoreInfoLink gets replaced with {0}. so that should do the trick.

    Hope it helps you,

    Richard

  • Chriztian Steinmeier 2800 posts 8790 karma points MVP 8x admin c-trib
    Oct 29, 2009 @ 13:26
    Chriztian Steinmeier
    0

    Oh - my bad - I was assuming this was happening inside an XSLT file.

    /Chriztian

  • bayshield 50 posts 65 karma points
    Oct 29, 2009 @ 13:47
    bayshield
    0

    Thanks for all your replies!  Richards code did the trick.

  • Josh Townson 67 posts 162 karma points
    Oct 29, 2009 @ 14:58
    Josh Townson
    4

    Just another option - you can do this without needing the inline xslt:

    <a href="{localLink:<umbraco:Item field='MoreInfoLink' runat='server'></umbraco:Item>}">More Info</a>

    The {localLink:id} syntax from the richtext editor seems to work in templates on its own. Not sure if this would cause a performace hit, but I quite like the succinct nature, and you can then use the umbraco:Item properties to make it recursive, or have a backup property

  • Umair Hafeez Mughal 5 posts 25 karma points
    May 14, 2013 @ 12:24
    Umair Hafeez Mughal
    0

    Josh Townson, thanks a  lot ... very nice and simple solution ...

Please Sign in or register to post replies

Write your reply to:

Draft