Our Forum has Moved

This site is our old forum and is only here for achive until we get proper 301 redirects setup to make Google happy.

Please use our new community site - Our Umbraco - which contains an improved forum, documentation wiki, package repository and a member locator.

Go to Our Umbraco now

Learn everything about Umbraco
RenderMacroContent - Help! Options
stevenwilber
Posted: Tuesday, May 29, 2007 1:45:59 AM
Rank: Devotee

Joined: 5/5/2007
Posts: 50
Help - I've been struggling for hours with RenderMacroContent. I've read the posts here, but I can't get it to work.

First off I'm using V3 RC1, so maybe that's an issue.

I'm trying to render one macro from another, but keep receiving the error:
"Error parsing XSLT file: \xslt\xs_show_snippets.xslt"

The XSLT of this macro is:
Code:
<xsl:template match="/">
    <xsl:value-of select="umbraco.library:RenderMacroContent('&lt;?UMBRACO_MACRO macroAlias=&quot;mc_snippet_book_online&quot;&gt;&lt;/?UMBRACO_MACRO&gt;', @id)" />
  </xsl:template>


I've tried to get all the escaping of characters correct and have followed the guide from Heather at:
http://en.wikibooks.org/wiki/Umbraco/Reference/umbraco.library/RenderMacroContent

The macro "mc_snippet_book_online" simple is a test macro at the minute and just outputs "Hello World".

Can anyone help me at all please as I'm going insane.

Thanks

Steven Wilber

Web Site Design - Essence Design
stevenwilber
Posted: Tuesday, May 29, 2007 1:48:42 AM
Rank: Devotee

Joined: 5/5/2007
Posts: 50
Damn! I'll try again as the post has cleverly interpreted all the escaping.

Code:
  <xsl:template match="/">
    <xsl:value-of select="umbraco.library:RenderMacroContent('&amp;lt;?UMBRACO_MACRO macroAlias=&amp;quot;mc_snippet_book_online&amp;quot;&amp;gt;&amp;lt;/?UMBRACO_MACRO&amp;gt;', @id)" />
  </xsl:template>


Web Site Design - Essence Design
stevenwilber
Posted: Tuesday, May 29, 2007 2:24:12 AM
Rank: Devotee

Joined: 5/5/2007
Posts: 50
Woohoo! I've found a solution and a better way to do it if it helps.

First of all the updated code:
Code:
&lt;xsl:variable name=&quot;Macro&quot;&gt;
  &lt;![CDATA[&lt;?UMBRACO_MACRO macroAlias=&quot;mc_snippet_book_online&quot;&gt;&lt;/?UMBRACO_MACRO&gt;]]&gt;
&lt;/xsl:variable&gt;
&lt;xsl:value-of select=&quot;umbraco.library:RenderMacroContent($Macro, $currentPage/@id)&quot; disable-output-escaping=&quot;yes&quot; /&gt;


The problems I was having was by using @id as the second parameter. I've changed this to $currentPage/@id and that solved the problem.

Secondly I've found a quicker/clearer way to escape the macro code, but placing it into a variable as CDATA.

I hope that this helps someone else at some point.

Cheers to all

Steve

Web Site Design - Essence Design

The forum has moved

This forum is no longer in use, so you can't reply to this message - please go to Our Umbraco

Users browsing this topic
Guest


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.