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
Hi,
I want to pass a parameter to a macro.
I get the current user id, and I want this value to be passed to a macro for retrieving data related to the user.
Thanks beforehand.
Regards,Eduardo
Hi Eduardo
If you want to send a parameter through a macro and into XSLT you can go ahead and do it like this:
<umbraco:Macro Alias="YourMacroAlias" runat="server" YourParamName="TheParamContent"></umbraco:Macro>
Then in your XSLT-file your can grab the value this way:
<xsl:variable name="VariableName" select="macro/YourParamName/."></xsl:variable>
Remember to declare the parameter in the developer section, on the macro where the param should be used.
After this you should be able to use the variable with the content of the parameter :)
/Kim A
If you mean the current member that is logged in in the frontend, it's already available to you, here is an example in the old (4.0) schema:
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp " "> ]><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxml="urn:schemas-microsoft-com:xslt" xmlns:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets" exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets "><xsl:output method="xml" omit-xml-declaration="yes"/><xsl:param name="currentPage"/><xsl:template match="/"><div class="welcomebadge"> <xsl:choose><xsl:when test="umbraco.library:IsLoggedOn() = true()"><xsl:variable name="member" select="umbraco.library:GetCurrentMember()" /><span class="hello">Hello</span><span class="username"><xsl:value-of select="$member/data [@alias = 'Voornaam']" /> <xsl:value-of select="$member/data [@alias = 'Naam']" />,</span></xsl:when> <xsl:otherwise> You are not logged in!!!<a href="/login">Login</a> </xsl:otherwise> </xsl:choose></div></xsl:template></xsl:stylesheet>
If you have a different scenario, please give some more information
Hi folks,
I am going to test it now.
Thank you for your answers.
Perfect, it runs well.
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Xslt parameters
Hi,
I want to pass a parameter to a macro.
I get the current user id, and I want this value to be passed to a macro for retrieving data related to the user.
Thanks beforehand.
Regards,
Eduardo
Hi Eduardo
If you want to send a parameter through a macro and into XSLT you can go ahead and do it like this:
Then in your XSLT-file your can grab the value this way:
Remember to declare the parameter in the developer section, on the macro where the param should be used.
After this you should be able to use the variable with the content of the parameter :)
/Kim A
If you mean the current member that is logged in in the frontend, it's already available to you, here is an example in the old (4.0) schema:
If you have a different scenario, please give some more information
Hi folks,
I am going to test it now.
Thank you for your answers.
Regards,
Eduardo
Hi,
Perfect, it runs well.
Thank you for your answers.
Regards,
Eduardo
is working on a reply...