Copied to clipboard

Flag this post as spam?

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


  • Akruti 30 posts 50 karma points
    Dec 29, 2009 @ 08:45
    Akruti
    0

    Getting child node items

    Hey i have one page where i need to show the sub menu items from one menu. I dont want to show all sub menu items but only those that belong under a particular menu item.Like eg i have Services menu then under Services i have 4 sub items then when i go to the 1st sub item page then the rest 3 should get displayed on that page. Please help me with this as soon as possible. Thank you.

    Akruti.

  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    Dec 29, 2009 @ 15:00
    Sebastiaan Janssen
    0

    I don't have an XSLT example right now, but this is what you should do:

    In the $currentPage, go up one level (with $currentPage/..) and do a for-each on the subitems of that parent node.

    In your for-each, check if the id of the subpage is equals to the current page, don't show the submenu when the id's are the same.

  • Akruti 30 posts 50 karma points
    Dec 30, 2009 @ 07:31
    Akruti
    0

    Hey thanks for this. I have displayed the sub items through the built in xslt i.e. listing subpages from changable source.Now one thing is want is that i have Services menu in that i have Service 1, Service 2 and so on .So when a user goes inside Service1 page i have the submenu listed there which lists every subitem inside the services menu. So inside this submenu i want that Service1 should be highlighted so the user comes to know that which page is he on. Can you please tell me how can I achieve this. I want the similar functionality for all subpages.

  • vijay 129 posts 152 karma points
    Dec 30, 2009 @ 07:50
    vijay
    0

    Hi akruti,

    My name is vijay.I m from mumbai.I m also new to Umbraco.Can we share our knowledge about umbraco if you have no problem.

    hope you will give positive reply.

    Have a nice day......tc.....bye.

    --vijay.

  • Akruti 30 posts 50 karma points
    Dec 31, 2009 @ 10:27
    Akruti
    0

    Hey vijay i really dont have much idea on this but i have just read some documentation on umbraco.That was a good start for me.

  • Akruti 30 posts 50 karma points
    Dec 31, 2009 @ 10:28
    Akruti
    0

    Hey please help me with this. I want the current page node name so how can i get it. I want the name of the page that is currently being displayed.Please respond as soon as possible.

  • Yannick Smits 321 posts 718 karma points
    Dec 31, 2009 @ 10:38
    Yannick Smits
    0

    try this:

    <?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"

            exclude-result-prefixes="msxml umbraco.library">

     

      <xsl:output method="xml" omit-xml-declaration="yes" />

      <xsl:param name="currentPage"/>

      <xsl:param name="level" select="1"/>

      <xsl:template match="/">

     

        <xsl:call-template name="menu">

          <xsl:with-param name="level" select="$level"/>

        </xsl:call-template>

     

      </xsl:template>

     

      <xsl:template name="menu">

     

        <xsl:param name="level"/>

     

        <xsl:if test="count($currentPage/ancestor-or-self::node [@level=$level]/node [string(data [@alias='umbracoNaviHide']) != '1']) &gt; '0'">

          <ul>

            <xsl:for-each select="$currentPage/ancestor-or-self::node [@level=$level]/node [string(data [@alias='umbracoNaviHide']) != '1']">

              <li>

                <xsl:choose>

                  <xsl:when test="$currentPage/ancestor-or-self::node/@id = current()/@id">

                    <strong>

                      <a href="{umbraco.library:NiceUrl(@id)}">

                        <xsl:value-of select="@nodeName"/>

                      </a>

                    </strong>

                  </xsl:when>

                  <xsl:otherwise>

                    <a href="{umbraco.library:NiceUrl(@id)}">

                      <xsl:value-of select="@nodeName"/>

                    </a>

                  </xsl:otherwise>

                </xsl:choose>

                <xsl:if test="$currentPage/ancestor-or-self::node/@id = current()/@id">

                  <xsl:call-template name="menu">

                    <xsl:with-param name="level" select="$level+1"/>

                  </xsl:call-template>

                </xsl:if>

              </li>

            </xsl:for-each>

          </ul>

        </xsl:if>

     

      </xsl:template>

    </xsl:stylesheet>

  • vijay 129 posts 152 karma points
    Dec 31, 2009 @ 11:39
    vijay
    0

    hi Akruti,

    I want to know on which technology u r working. If u have no problem can we share our ideas.I want ot become u r frnd.i m poor in xslt can u send me any useful documentation on xslt.

    tc bye..

    vijay.

  • vijay 129 posts 152 karma points
    Dec 31, 2009 @ 11:43
    vijay
    0

    Hi akruti,

    Kemcho.If u have no problem mail me on [email protected].

    Hope for positive reply.

    --vijay.

     

  • Chris Houston 535 posts 980 karma points MVP admin c-trib
    Dec 31, 2009 @ 12:41
    Chris Houston
    0

    Hi,

    To answer one of Akruti's questions above to just get the current page's name using XSLT:

    <xsl:value-of select="$currentPage/@nodeName" />

    Or you can also use:

    <xsl:value-of select="./@nodeName" />

    By using the second example it will also work if you include this within a for-each loop.

    Cheers,

    Chris

  • Akruti 30 posts 50 karma points
    Jan 01, 2010 @ 12:05
    Akruti
    0

    Hey Chris Thanks a lot. Can you please help me with this more. I want to compare the current node with all the sub nodes and want to write an if block that if the node is equal then i want the color of that text to be white. So if the node is the current node than the color of that text should be different than other nodes. Please provide me with the solution. Thanks in advance.

  • dennish 17 posts 41 karma points
    Jan 01, 2010 @ 15:49
    dennish
    0

    You mean adding a class to the list item (li) of the selected node? 

    Then this should work.

    <xsl:if test="$currentPage/self::node/@id = current()/@id">

    <xsl:attribute name="class">selected</xsl:attribute>

    </xsl:if>

  • Akruti 30 posts 50 karma points
    Jan 02, 2010 @ 09:48
    Akruti
    0

    Hey thanks dennish. I managed to compare it with <xsl:when> block.

  • vijay 129 posts 152 karma points
    Jan 02, 2010 @ 10:34
    vijay
    0

    Hi Akruti,

    I wish u a happy new year.

    ----- vijay.

Please Sign in or register to post replies

Write your reply to:

Draft