Copied to clipboard

Flag this post as spam?

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


  • Bex 444 posts 555 karma points
    Oct 15, 2010 @ 16:38
    Bex
    0

    XSLT Extensions - What's wrong with this?

    Hello!

    I seem to be completely missing something and I am hoping one of you can help..

    I have created an xslt extension which I have used before and I am referencing in a few of my xslt files and alls working well.

    I have now added a new function to my code that I want to call from xslt and it's not happening properly.

    My function is called "GetTeamName", it accepts an Id and returns a string

    My extension is referenced at the top of my xslt like so: (I know i has a random name.. ignore that)

     xmlns:Domains="urn:Domains" 

     

    I have this in my xslt that is calling the id (which it gets from a custom dropdown datatype)

     <xsl:value-of select="data [@alias = 'Team']"/>

     

    To get the team name I am using the following:

    <xsl:variable name="teamId" select="data [@alias = 'Team']"/>
    <strong>Domains:GetTeamName(@teamId)</strong>

    But all I get on the page is Domains:GetTeamName(@teamId) in bold!

    What am I doing wrong? I can't work out what I'm missing as I have used the domains extension before I've just added a new function!

    Bex

  • Bex 444 posts 555 karma points
    Oct 15, 2010 @ 16:41
    Bex
    0

    another duplicate.. please ignore and use the other one

  • Kim Andersen 1447 posts 2196 karma points MVP
    Oct 18, 2010 @ 19:10
    Kim Andersen
    0

    Hi Bex!

    I can't seem to find "the other post", so I guess that this is the right one to answer.

    To use your extension, you need to write it out in a value-of. Like this:

    <xsl:value-of select="Domains:GetTeamName($teamId)" />

    This will print out whatever is returned from the extension.

    /Kim A

  • Kim Andersen 1447 posts 2196 karma points MVP
    Oct 18, 2010 @ 19:14
    Kim Andersen
    0

    Ohh, and by the way, when you are referring the variable, teamId, you have to use the $-sign and not the @-sign :)

    /Kim A

  • Bex 444 posts 555 karma points
    Oct 19, 2010 @ 09:53
    Bex
    0

    Thanks for your reply Kim! Yes I did solve it.. think I was having a Friday Afternoon blip! :)

    I should have out a link here but that said I can't find it my self now as this is the one that appears in my notifications..

  • Kim Andersen 1447 posts 2196 karma points MVP
    Oct 19, 2010 @ 19:31
    Kim Andersen
    0

    Ahh, I have just found the other post by looking at your profile. Didn't think of that yesterday :)

    To anyone interested it can be found here: http://our.umbraco.org/forum/developers/xslt/13613-XSLT-Extensions-What%27s-wrong-with-this

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies