Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
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
Hi! You'll need xsl:value-of select to use the function:
<xsl:value-of select="Domains:GetTeamName(@teamId)"/>
I have tried that and I was getting an error when I run the page? So thought I was doing it wrong.
I get the error: "Error parsing XSLT file": does that mean there is a problem with my code or the xslt? and how on earth do I debug it?
I'm sorry feel as if I'm losing the plot as I've worked with these before with no trouble.. having a mental block I think!
OMG the light bulb has just come on! My function is expecting an int, where as it's seeing the team Id as a string! doh!
Friday afternoon and all... :) What I see looks good, can you post the "header" of the xslt?
Try adding ?umbdebugshowtrace=1 to your url to get more information on what's wrong.
Or run the Xslt with the xslt visualizer (in Umbraco admin Xslt editor), a great tool.
Other than that: http://en.wikibooks.org/wiki/Umbraco/Create_xslt_exstension_like_umbraco.Library_in_C
Regards
Jonas
Aha you solved it, great!
I've got it working. I've switched my function to accept a string and then parsing it to an int there and I am running the function as follows:
<xsl:value-of select="Domains:GetTeamName(data [@alias = 'Team'])"/>
Definitely friday afternoon feeling!
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
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)
I have this in my xslt that is calling the id (which it gets from a custom dropdown datatype)
To get the team name I am using the following:
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
Hi! You'll need xsl:value-of select to use the function:
I have tried that and I was getting an error when I run the page? So thought I was doing it wrong.
I get the error: "Error parsing XSLT file": does that mean there is a problem with my code or the xslt? and how on earth do I debug it?
I'm sorry feel as if I'm losing the plot as I've worked with these before with no trouble.. having a mental block I think!
OMG the light bulb has just come on! My function is expecting an int, where as it's seeing the team Id as a string! doh!
Friday afternoon and all... :) What I see looks good, can you post the "header" of the xslt?
Try adding ?umbdebugshowtrace=1 to your url to get more information on what's wrong.
Or run the Xslt with the xslt visualizer (in Umbraco admin Xslt editor), a great tool.
Other than that: http://en.wikibooks.org/wiki/Umbraco/Create_xslt_exstension_like_umbraco.Library_in_C
Regards
Jonas
Aha you solved it, great!
I've got it working. I've switched my function to accept a string and then parsing it to an int there and I am running the function as follows:
Definitely friday afternoon feeling!
is working on a reply...