Copied to clipboard

Flag this post as spam?

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


  • Elad Lachmi 112 posts 144 karma points
    Apr 10, 2011 @ 15:54
    Elad Lachmi
    0

    macro not working when in child node

    Hi,

    I'm new to xslt. I have the following xslt macro:

     <xsl:template match="/">

    <!-- start writing XSLT -->
      <ul class="footer-broker-list">
      <xsl:for-each select="$currentPage//broker [@isDoc]">
        <li>
                <a>
                  <xsl:attribute name="href">
                    <xsl:value-of select="umbraco.library:NiceUrl(current()/@id)"/>
                  </xsl:attribute>
                  <xsl:attribute name="style">
                    text-decoration: none;
                  </xsl:attribute>
                  <xsl:value-of select="./brokerName" /></a></li>
      </xsl:for-each>
      </ul>
    </xsl:template>

    This works well on the home page, but does not display anything when put in child pages.

    What do I need to modify in order to have it work anywhere?

    Thank you!

  • Eran Meir 401 posts 543 karma points
    Apr 10, 2011 @ 16:52
    Eran Meir
    0

    you need change the select "$currentPage:ancestor-or-self//broker"

  • Elad Lachmi 112 posts 144 karma points
    Apr 10, 2011 @ 17:03
    Elad Lachmi
    0

    Thanks for the reply, but this give me an error:

    "Prefix 'currentPage' is not defined."

  • Eran Meir 401 posts 543 karma points
    Apr 10, 2011 @ 17:06
    Eran Meir
    0

    i'm sorry try this $currentPage:ancestor-or-self::*//broker

  • Elad Lachmi 112 posts 144 karma points
    Apr 10, 2011 @ 17:09
    Elad Lachmi
    0

    Nope :) Still not it.

  • Eran Meir 401 posts 543 karma points
    Apr 10, 2011 @ 17:10
    Eran Meir
    0

    whats the error you're getting now?

  • Pasang Tamang 252 posts 394 karma points
    Apr 10, 2011 @ 17:25
    Pasang Tamang
    0

    Did you try $currentPage/ancestor-or-self::*//broker [@isDoc] ?

    Pnima

  • Elad Lachmi 112 posts 144 karma points
    Apr 10, 2011 @ 17:28
    Elad Lachmi
    0

    Thanks Pnima. That did the trick.

  • Pasang Tamang 252 posts 394 karma points
    Apr 10, 2011 @ 17:40
    Pasang Tamang
    0

    Glad to hear it solved your problem..

    Pnima

  • 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