Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Zac 239 posts 541 karma points
    Jul 24, 2009 @ 20:48
    Zac
    0

    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 "&#x00A0;"> ]> <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>

     


     

     

     

     

  • Douglas Robar 3570 posts 4711 karma points MVP ∞ admin c-trib
    Jul 24, 2009 @ 22:22
    Douglas Robar
    1

    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.

  • Zac 239 posts 541 karma points
    Jul 24, 2009 @ 22:37
    Zac
    0

    that's what i was afraid of.  thanks.

Please Sign in or register to post replies

Write your reply to:

Draft