Could anyone give me XSLT example using RenderMacroContent , which renders macro contents added in umbraco rich text edior. I am trying with macro "CWS_Navi" from CWS starter kit as :
To me, it looks like you are calling RenderMacroContent correctly. It shouldn't make a difference, but try removing the "runat=server" attribute from the macro string.
I tried without server tag and still giving me blank string . This is not a .NET control .
Its an XSLT macro from CWS starter kit , named : [XSLT] Navi . And i am adding this macro to my page using RTE , and want to render its ouput using XSLT.could you provide the XSLT to display any XSLT macro? can pick any XSLT macro from CQS starter site.
That snippet worked good, i am able to displa macros , but i guess for .NET controls it does not work . As i am able to display .NET controls but not able to do postback.
XSLT RenderMacroContent
Could anyone give me XSLT example using RenderMacroContent , which renders macro contents added in umbraco rich text edior. I am trying with macro "CWS_Navi" from CWS starter kit as :
<xsl:value-of select="umbraco.library:RenderMacroContent('<?UMBRACO_MACRO macroAlias="CWS_Navi" runat="server" > </?UMBRACO_MACRO>', $currentPage/@id)" disable-output-escaping="yes"/>
But it is showing me blank string.
Please advice.
Thanks!
Hi shruti,
To me, it looks like you are calling RenderMacroContent correctly. It shouldn't make a difference, but try removing the "runat=server" attribute from the macro string.
What is the underlying control of the macro? .NET user-control (ASCX) or an XSLT?
If it's a .NET user-control, then it's a no-go! The rendering of XSLT happens to far into the ASP.NET Page Life-cycle to load-in. (sorry)
Good luck, Lee.
I tried without server tag and still giving me blank string . This is not a .NET control .
Its an XSLT macro from CWS starter kit , named : [XSLT] Navi . And i am adding this macro to my page using RTE , and want to render its ouput using XSLT.could you provide the XSLT to display any XSLT macro? can pick any XSLT macro from CQS starter site.
Thanks,
For an example
Nested macro :
<?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:variable name="rootTextpageNode" select="$currentPage/ancestor-or-self::node [@level = 2 and @nodeTypeAlias = 'CWS_Textpage']" />
<div class="secondaryNav">
<h3>
<xsl:value-of select="$rootTextpageNode/@nodeName"/>
</h3>
<ul>
<xsl:for-each select="$rootTextpageNode/node">
<li>
<xsl:if test="$currentPage/ancestor-or-self::node/@id = current()/@id">
<xsl:attribute name="class">
<xsl:text>selected</xsl:text>
</xsl:attribute>
</xsl:if>
<a href="{umbraco.library:NiceUrl(current()/@id)}">
<span>
<xsl:value-of select="current()/@nodeName"/>
</span>
</a>
</li>
</xsl:for-each>
</ul>
</div>
</xsl:template>
</xsl:stylesheet>
XSLT to read above MACRO
<?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:variable name="replaceThis">
<xsl:text>class="nofollow"</xsl:text>
</xsl:variable>
<xsl:variable name="replaceWith">
<xsl:text>rel="nofollow"</xsl:text>
</xsl:variable>
<xsl:value-of select="umbraco.library:Replace($currentPage/data[@alias='bodyText'], $replaceThis, $replaceWith)" disable-output-escaping="yes" />
<xsl:value-of select="umbraco.library:RenderMacroContent('<?UMBRACO_MACRO macroAlias="CWS_SubNavi" runat="server" > </?UMBRACO_MACRO>', $currentPage/@id)" disable-output-escaping="yes" />
</xsl:template>
</xsl:stylesheet>
And this shows the contents of the page but not rendering macro .
Please advice
Hi Shruti
I have used the following code to render my content from a richtext editor:
I used this to successfully render my content including a macro inserted into the richtext editor. Hope this helps out.
/Kim A
Great snippet Kim! This is exactly what i was looking for! :)
Kim,
That snippet worked good, i am able to displa macros , but i guess for .NET controls it does not work . As i am able to display .NET controls but not able to do postback.
But thank you so much for your help. :)
is working on a reply...