Copied to clipboard

Flag this post as spam?

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


  • Niklas Hjelm 104 posts 125 karma points
    Jun 01, 2011 @ 14:31
    Niklas Hjelm
    0

    Recursive from ultimate picker

    Hi

    I have macro on root level which I'm having some trouble getting resursive. Using ultimate picker from Lees example. Works fine on the start page but not on subpages, what should I change?

    Thanks / Niklas

    <code>

      <xsl:template match="/">
        

        <xsl:variable name="preNodes">
              <xsl:variable name="relatedContent" select="$currentPage/monthOfferPicker" />
              <xsl:variable name="nodeIds" select="umbraco.library:Split($relatedContent, ',')" />
              <xsl:for-each select="$nodeIds/value">
                <xsl:copy-of select="umbraco.library:GetXmlNodeById(.)"/>
              </xsl:for-each>
        </xsl:variable>
        <xsl:variable name="nodes" select="msxml:node-set($preNodes)/*[@isDoc]" />
        <xsl:if test="count($nodes) > 0">


    <xsl:for-each select="$nodes">


        <xsl:variable name="mediaId" select="number(monthOfferImage)" />
        <xsl:if test="$mediaId > 0">
        <xsl:variable name="mediaNode" select="umbraco.library:GetMedia($mediaId, 0)" />
      
        <xsl:if test="$mediaNode/umbracoFile">
         
          <img>
            <xsl:attribute name="src">
                <xsl:text>/ImageGen.ashx?image=</xsl:text>
                <xsl:value-of select="$mediaNode/umbracoFile" />
                <xsl:text>&amp;height=130</xsl:text>
                <xsl:text>&amp;compression=95</xsl:text>
                <xsl:text>&amp;constrain=true</xsl:text>

                </xsl:attribute>
            <xsl:attribute name="alt"><xsl:value-of select="$mediaNode/@nodeName" /></xsl:attribute>
          </img>
     

        </xsl:if>

      </xsl:if>

     <h5>
        <xsl:variable name="monthOfferLink" select="monthOfferLink" />
        <xsl:if test="$monthOfferLink!= ''">
          <href="{umbraco.library:NiceUrl($monthOfferLink)}">  <xsl:value-of select="monthOfferHeadline"/>
          </a>
        </xsl:if>
      </h5>

      <xsl:value-of select="monthOfferText" disable-output-escaping="yes"/>
      
    <xsl:variable name="monthOfferLink" select="monthOfferLink" />
    <xsl:if test="$monthOfferLink!= ''">
      <class="arrowTextLink" href="{umbraco.library:NiceUrl($monthOfferLink)}">
       Läs mer
      </a>
    </xsl:if>

    </xsl:for-each>
        


    </xsl:if>
    </xsl:template>

    </code>

     

     

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Jun 02, 2011 @ 12:31
    Dennis Aaen
    0

    Hi Niklas,

    I do not know if it will solve your problem but maybe. I know that it is possible to put an attribute on your macro.

    The attribute is called recursive and has the value true. So maybe you could try something like this.

    <umbraco:Macro Alias="macoAlias" recursive="true" runat="server"></umbraco:Macro>

    I have not tried myself so I do not know if it will solve your issues.

    But hope it helps you.

    /Dennis

Please Sign in or register to post replies

Write your reply to:

Draft