Copied to clipboard

Flag this post as spam?

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


  • Kelvin Thursby 16 posts 36 karma points
    Feb 21, 2012 @ 13:25
    Kelvin Thursby
    0

    creating link from parameter

     Hi,

    Here is the code i have to get create a link from the current node type but am getting the following error!

    System.OverflowException: Value was either too large or too small for an Int32.

    <xsl:param name="currentPage"/>
        <xsl:param name="link" select="/macro/link"/>

    <xsl:template match="/">
    <a href="{umbraco.library:NiceUrl('@link')}">This is the link</a>
    </xsl:template>
    </xsl:stylesheet>

    Thanks in advance for the help

    Kelvin

  • Chriztian Steinmeier 2800 posts 8790 karma points MVP 8x admin c-trib
    Feb 21, 2012 @ 13:36
    Chriztian Steinmeier
    0

    Hi Kelvin,

    It's because your'e sending the string '@link' into the NiceUrl() extension - just remove the apostrophes:

    <a href="{umbraco.library:NiceUrl(@link)}">This is the link</a>

    It's usually also a good idea to check the value first because the extension will fail with the same error if no value is in the @link attribute (which can happen when you save the XSLT in the Backoffice):

    <xsl:if test="normalize-space(@link)">
        <a href="{umbraco.library:NiceUrl(@link)}">This is the link</a> 
    </xsl:if>
    

    /Chriztian

  • Kelvin Thursby 16 posts 36 karma points
    Feb 21, 2012 @ 13:45
    Kelvin Thursby
    0

    Hi,

    I still get the error. Also when i try the <xsl:iftest="normalize-space(@link)"> nothing is displayed

    Am i calling the link parameter correctly?

    Thanks

    Kelvin

  • Chriztian Steinmeier 2800 posts 8790 karma points MVP 8x admin c-trib
    Feb 21, 2012 @ 13:48
    Chriztian Steinmeier
    0

    Ah - no, sorry :-)

    I thought you were using a Related Link datatype

    Replace @link with $link and you'll be good to go.

    /Chriztian

  • Kelvin Thursby 16 posts 36 karma points
    Feb 21, 2012 @ 13:58
    Kelvin Thursby
    0

    Great Thanks for that!

Please Sign in or register to post replies

Write your reply to:

Draft