Search code examples
xsltumbracoxslt-1.0umbraco-blog

Two microalias in single umbraco.library:RenderMacroContent method


For the desktop site I have a content in Umbraco where <p><?UMBRACO_MACRO macroAlias="StoryDesc" /></p> refers to XSLTName field

I am making a call from one XSLT to StroyDesc XSLT as

<xsl:variable name="StoryXSLT" select="$currentPage/XSLTName"/>

<xsl:value-of select="umbraco.library:RenderMacroContent(StoryXSLT, $currentPage/id)" />

Now for mobile site I have different XSLT MobileStoryDesc instead of StoryDesc. I cannot add a new separate content like <p><?UMBRACO_MACRO macroAlias="MobileStoryDesc" /></p>. But I can alter the existing content without affecting the present desktop site.

Is it possible to make a XSLT call. Please suggest me a solution. Thanks in advance.


Solution

  • I might not quite understand you, so apologies if I'm mixed up.

    Why not create a MobileStoryXSLT & a DesktopStoryXSLT and use the StoryDescXSLT to choose which one to use?

    Something like:

    <xsl:if test="...desktop...">
       <xsl:value-of select="umbraco.library:RenderMacroContent(DesktopStoryXSLT, $currentPage/id)" />
    </xsl:if>
    <xsl:if test="... mobile ...">
        <xsl:value-of select="umbraco.library:RenderMacroContent(MobileStoryXSLT, $currentPage/id)" />
    </xsl:if>