I'm trying to build up a href in xslt based upon the node of the page and a property of the logged in person. So what I actually want to end up with is something like the following href:
Might be two separate problems here - first one is when you save the XSLT, Umbraco will run the transform using the Content node as $currentPage, so some functions (like the NiceUrl() one) will fail if not guarded against. Sometimes you can work around this by clicking the Skip errors checkbox before saving.
Second one is how you build the attribute, which you didn't mention - but here's some code to get you started:
<xsl:variable name="delidcode" select="umbraco.library:GetCurrentMember()/delegateid" />
<xsl:template match="/">
<!-- Don't do anything if no current member -->
<xsl:if test="$delidcode">
<a href="{umbraco.library:NiceUrl($currentPage/@id)}?delidcode={$delidcode}">
<xsl:value-of select="$currentPage/@nodeName" />
</a>
</xsl:if>
</xsl:template>
Build a href in xslt
Hi folks,
I'm utterly stumpoed with this one!!
I'm trying to build up a href in xslt based upon the node of the page and a property of the logged in person. So what I actually want to end up with is something like the following href:
/members-page.aspx?delidcode=123456
What I have is:
Which builds the /members-page.aspx part
and
Which gives me the 123456 part based upon the logged in member.
But I have no clue as to how to append them together to form the href. Everything that I've tried gives me syntax erros when I try to save the xslt.
Could anybody help please?
Thanks,
Craig
Hi Craig,
Might be two separate problems here - first one is when you save the XSLT, Umbraco will run the transform using the Content node as
$currentPage
, so some functions (like theNiceUrl()
one) will fail if not guarded against. Sometimes you can work around this by clicking the Skip errors checkbox before saving.Second one is how you build the attribute, which you didn't mention - but here's some code to get you started:
/Chriztian
Genius! You are a genius!
Had to amend it slightly as all of the links were for the current page but other than that you were bang on!!
Final code:<!-- Don't do anything if no current member -->
<xsl:if test="$delidcode">
<a href="{umbraco.library:NiceUrl(@id)}?delidcode={$delidcode}">
<xsl:value-of select="@nodeName" />
</a>
</xsl:if>
Thanks a million!
is working on a reply...