Copied to clipboard

Flag this post as spam?

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


  • Kate 267 posts 610 karma points
    Nov 07, 2012 @ 12:51
    Kate
    0

    Using recursive='true' in a macro

    How can I use recursive='true' in a macro?

    I have insert a macro on the frontpage and would like the output of the macro to come out on the pages there lies below the frontpage.

    I have this xslt fil:


    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]>
    <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" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets"
      exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets ">


    <xsl:output method="xml" omit-xml-declaration="yes"/>
      <xsl:variable name="temp" select="string(/macro/urlNumber)"/>
      <xsl:variable name="class" select="string(/macro/className)"/>
      <xsl:variable name="text" select="string(/macro/tagText)"/>
      <xsl:variable name="bgImg" select="/macro/bgImage/*/umbracoFile"/>
    <xsl:param name="currentPage"/>

    <xsl:template match="/">
      <xsl:choose>
      <xsl:when test="$class != '' and $text != '' and $temp != ''">
        <a href="{umbraco.library:NiceUrl($temp)}" class="{$class}" style='background:url("{$bgImg}") 25px 10px no-repeat;'>
          <xsl:value-of select="$text" disable-output-escaping="yes"/>    
        </a>
      </xsl:when>
      <xsl:when test="$temp != ''">
        <xsl:value-of select="umbraco.library:NiceUrl($temp)"/>
      </xsl:when>
      </xsl:choose>
    </xsl:template>

    </xsl:stylesheet>

     

  • Ismail Mayat 4511 posts 10059 karma points MVP 2x admin c-trib
    Nov 07, 2012 @ 18:00
    Ismail Mayat
    0

    Kate,

    You need to look at template inheritance. Am I right in assuming that the lower level pages and the front page need to all show this macro?  If so then you need to create a master template. The home page and lower level pages need to inherit from this master page.  Put your macro in the master and the other pages will due to template inheritance all show the content of the macro.  You may need to mess around with existing html to get it to work.

    Regards

    Ismail

  • Kate 267 posts 610 karma points
    Nov 07, 2012 @ 18:10
    Kate
    0

    Hi Ismail

    Thanks for your respond, but this is not the right solution for me.

    I was more thinking of a solution like in this question http://our.umbraco.org/forum/developers/xslt/28889-Recursive-field-in-XSLT but I can't seem to get it to work

     

  • Kate 267 posts 610 karma points
    Nov 07, 2012 @ 18:41
    Kate
    0

    I just found a solution that have nothing to to with the link above.

    When I insert the macro in the templates I write this :

    <umbraco:Macro urlNumber="[$faneblad3Link]" className="test" tagText="[$faneblad3Overskrift]" bgImage="[$faneblad3Ikon]" Alias="GetUrlString"  runat="server"></umbraco:Macro>

    The diffrent was this:

    urlNumber="[$faneblad3Link]"    (the right way, when I want it to be recursive)
    urlNumber="[#faneblad3Link]"

     

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies