How to call a usercontrol macro from an xslt macro?
I am trying to create an xslt macro that calls a usercontrol macro that I've created and appropriately passes some values to it. I've tried using umbraco.library:RenderMacroContent to no avail but it may very well be because I'm not using it properly. I'm using umbraco 4.0.2. Any help would be greatly appreciated.
Here's the problem
1. I've created a Poll usercontrol that works perfectly on its own. I'm trying to wrap it in a macro now
2. The code below is my xslt macro that is calling the Poll.
If you want to use the .net usercontrol from within an xslt macro you'd need to convert the usercontrol into an xslt extension, then you could do everything from within the xslt macro and use your xslt extension's functions just like you do the umbraco.library:xyz() functions in the umbraco xslt extension.
How to call a usercontrol macro from an xslt macro?
I am trying to create an xslt macro that calls a usercontrol macro that I've created and appropriately passes some values to it. I've tried using umbraco.library:RenderMacroContent to no avail but it may very well be because I'm not using it properly. I'm using umbraco 4.0.2.
Any help would be greatly appreciated.
Here's the problem
1. I've created a Poll usercontrol that works perfectly on its own. I'm trying to wrap it in a macro now
2. The code below is my xslt macro that is calling the Poll.
<?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" exclude-result-prefixes="msxml umbraco.library"> <xsl:output method="xml" omit-xml-declaration="yes"/> <xsl:param name="currentPage"/> <xsl:template match="/"> <xsl:for-each select="$currentPage/node [@nodeTypeAlias = 'Poll']"> <xsl:sort select="@createDate" order="descending" /> <xsl:value-of select="umbraco.library:RenderMacroContent('<umbraco:Macro PollID="{@pageID}" AllowMultipleVotes="0" Alias="Poll" runat="server"></umbraco:Macro>', @id)" disable-output-escaping="yes"/> </xsl:for-each> </xsl:template> </xsl:stylesheet>
One macro can't call another macro.
If you want to use the .net usercontrol from within an xslt macro you'd need to convert the usercontrol into an xslt extension, then you could do everything from within the xslt macro and use your xslt extension's functions just like you do the umbraco.library:xyz() functions in the umbraco xslt extension.
cheers,
doug.
that's what i was afraid of. thanks.
is working on a reply...