Copied to clipboard

Flag this post as spam?

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


  • Heather Floyd 610 posts 1032 karma points MVP 6x c-trib
    Jun 05, 2010 @ 04:27
    Heather Floyd
    0

    Rendering MacroPicker data with XSLT?

    Hi, I am using the MacroPicker datatype (http://our.umbraco.org/projects/macropicker)

    Setting it up wasn't a problem, but now I am having a problem using the data from a node in an XSLT.

    This code:

    <xsl:if test="string($ContentNode/@id)!=''">
                <xsl:value-of select="umbraco.library:RenderMacroContent($ContentNode/data [@alias = 'BlurbMacro'], $ContentNode/@id)" />
            </xsl:if>

    Returns this error as output:

    <!-- Error generating macroContent: 'System.ArgumentException: The string parameter 'key' cannot be null or empty. Parameter name: key at System.Web.UI.StateBag.get_Item(String key) at System.Web.UI.AttributeCollection.get_Item(String key) at umbraco.template.parseStringBuilder(StringBuilder tempOutput, page umbPage) in d:\TeamCity\buildAgent\work\7380c184e9fcd3ea\umbraco\presentation\template.cs:line 208 at umbraco.library.RenderMacroContent(String Text, Int32 PageId) in d:\TeamCity\buildAgent\work\7380c184e9fcd3ea\umbraco\presentation\library.cs:line 1125' -->

    Does anyone know what 'key' refers to? Has anyone else sucessfully used the MacroPicker in XSLT? Should I be doing something other than using "RenderMacroContent" to get its output?

    If I just do this:

    <xsl:value-of select="$ContentNode/data [@alias = 'BlurbMacro']" />

    It outputs this:

    <?UMBRACO_MACRO macroalias="Testimonials_GetRandom" numberOfItems="1" source="1216" IncludeHeader="0" IncludeImage="0" ImageWidth="" ImageHeight="" ExcludeIfSamePage ="0" />

    Thanks for any ideas!

    ~Heather

  • Heather Floyd 610 posts 1032 karma points MVP 6x c-trib
    Jun 05, 2010 @ 20:28
    Heather Floyd
    0

    BTW: I am using umbraco v 4.0.4.1 (Assembly version: 1.0.3793.17632)

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Jun 07, 2010 @ 01:42
    Lee Kelleher
    0

    Hi Heather,

    Have you tried rendering the literal Macro text/tag?

    <xsl:value-of select="umbraco.library:RenderMacroContent('&lt;?UMBRACO_MACRO macroalias=&quot;Testimonials_GetRandom&quot; numberOfItems=&quot;1&quot; source=&quot;1216&quot; IncludeHeader=&quot;0&quot; IncludeImage=&quot;0&quot; ImageWidth=&quot;&quot; ImageHeight=&quot;&quot; ExcludeIfSamePage=&quot;0&quot; /&gt;', 1234)" />

    Not sure what the content node Id was, so just used "1234" for this example.

    Only other thing I noticed about the Macro text/tag is that the attribute "ExcludeIfSamePage" has a space after it, and before the equals symbol? But thinking that's a copy-n-paste issue on the forum?

    Let us know how it goes.

    Cheers, Lee.

Please Sign in or register to post replies

Write your reply to:

Draft