Copied to clipboard

Flag this post as spam?

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


  • MartinB 411 posts 512 karma points
    Nov 29, 2011 @ 10:12
    MartinB
    0

    value of select not outputting (4.7.1)

    Hi there

    I must have forgotten something since my last go with Umbraco :-)

    I'm doing a topnavigation where i want a short description below the a tag from a doc property and i have done so on an older version of umbraco where it looked like this:

    <p class="linkDescription"><xsl:value-of select="data[@alias='siteDescription']"/></p>

    In my 4.7.1 installation i'm doing this with no succes:

    <xsl:param name="currentPage"/>
    
        <!-- Input the documenttype you want here -->
        <xsl:variable name="level" select="1"/>
    
        <xsl:template match="/">      
            <ul class="topNav">
                <li class="topNavLi">             
                    <a href="/" class="navigation">
                        <xsl:if test="$currentPage/@id = $currentPage/ancestor-or-self::* [@level=$level]/@id">
                            <xsl:attribute name="class">navigation current</xsl:attribute>
                        </xsl:if>
                        Forside
                    </a>
                    <p><xsl:value-of select="pageMenuText"/></p>
                </li>
                <xsl:for-each select="$currentPage/ancestor-or-self::* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']">
                    <li class="topNavLi">         
                        <a class="navigation" href="{umbraco.library:NiceUrl(@id)}">
                            <xsl:if test="@id = $currentPage/@id">
                                <xsl:attribute name="class">navigation current</xsl:attribute>
                            </xsl:if>
                            <xsl:value-of select="@nodeName"/>
                        </a>
                        <p><xsl:value-of select="pageMenuText"/></p>
                    </li> 
                </xsl:for-each>
            </ul>
        </xsl:template>

    If i set $currentPage/pageMenuText i will get the value from the specific page i am on, on ALL the menu items.

    What am i missing here?

    Help much appreciated!

     

  • Dirk De Grave 4537 posts 6006 karma points MVP 3x admin c-trib
    Nov 29, 2011 @ 10:30
    Dirk De Grave
    1

    First occurence of pageMenuText won't have any value... it really needs $currentPage/pageMenuText, second occurence should be fine (Although it helps to have ./ in front of pageMenuText so you know you're currently looking up a property on the current node being processed in the for-each loop)

     

    Cheers,

    /Dirk

  • MartinB 411 posts 512 karma points
    Nov 29, 2011 @ 11:14
    MartinB
    0

    Hi Dirk

    Ah of course! Since i don't want the Frontpage subtext to change according to currentPage i'll just hardcode that part :-) The others are now working dynamically.

    Thanks for your swift reply!

  • 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