I'm having a bit of trouble trying to extract a url from a member and use it as a link in XSLT.
My scenario is: each Member has got a property of the type textstring to hold their url to their website. When I try to get hold of this in XSLT and use it as a regular link, the link looks like this on the frontend:
So basically it tries to find "http://www.theMemberUrlstring.com on my website. When I try to get the value-of my memberUrl variable it displays correctly - also if I use copy-of instead.
I don't think that using the xsl:attribute element will solve this problem. As far as I can tell it would output the same but of course it's worth the try.
@Bo: what format do you insert the url in? is it like http://www.yourmemberurl.com or just yourmemberurl.com? Have you tried to just use www.memberurl.com? And what happens if you just write <xsl:value-of select="$memberUrl" /> ?
Tim: thanks a lot for your help, but it wasn't the issue here :) Although you're right, I think it's best practice to output links like you described!
However, Jan is right here - it depends on if "http://" is included in the url string or not. If it isn't included, it will link to: http://www.yoursite.com/www.theUrl.com
So basically this little choose snippet here saved the day (or night, mayhaps? ;))
I think that it's a matter of preference how to pass the value to the href attribute. Using the xsl:attribute method is indeed nice when one needs to manipulate the href value dependent on certain cases etc one needs to test for.
Happy to see you got it solved. This is something that can be very annoying and confusing when working with Umbraco :-)
Strange URL behavior
Hi all,
I'm having a bit of trouble trying to extract a url from a member and use it as a link in XSLT.
My scenario is: each Member has got a property of the type textstring to hold their url to their website. When I try to get hold of this in XSLT and use it as a regular link, the link looks like this on the frontend:
So basically it tries to find "http://www.theMemberUrlstring.com on my website. When I try to get the value-of my memberUrl variable it displays correctly - also if I use copy-of instead.
My XSLT looks like this:
.. where $member//hjemmeside is the textstring property on the member that holds the url.
Anyone know of a 'hotfix' to this problem? :) Any help is greatly appreciated!
All the best,
Bo
It might be because the {} syntax url encodes the value (just guessing)?
If you change the code slightly like this:
<a target="_blank">
<xsl:attribute>
<xsl:value-of select="$memberUrl">
</xsl:attribute>
<xsl:text>thelink</xsl:text>
</a>
Does it work ok?
<xsl:attribute> should be <xsl:attribute name="href">, sorry!
Hi Bo and Tim
I don't think that using the xsl:attribute element will solve this problem. As far as I can tell it would output the same but of course it's worth the try.
@Bo: what format do you insert the url in? is it like http://www.yourmemberurl.com or just yourmemberurl.com? Have you tried to just use www.memberurl.com? And what happens if you just write <xsl:value-of select="$memberUrl" /> ?
/Jan
Tim: thanks a lot for your help, but it wasn't the issue here :) Although you're right, I think it's best practice to output links like you described!
However, Jan is right here - it depends on if "http://" is included in the url string or not. If it isn't included, it will link to: http://www.yoursite.com/www.theUrl.com
So basically this little choose snippet here saved the day (or night, mayhaps? ;))
Again, thanks for the help! :)
Hi Bo
I think that it's a matter of preference how to pass the value to the href attribute. Using the xsl:attribute method is indeed nice when one needs to manipulate the href value dependent on certain cases etc one needs to test for.
Happy to see you got it solved. This is something that can be very annoying and confusing when working with Umbraco :-)
/Jan
is working on a reply...