Copied to clipboard

Flag this post as spam?

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


  • Fuji Kusaka 2203 posts 4220 karma points
    Apr 12, 2012 @ 09:13
    Fuji Kusaka
    0

    Getting next node from the current node

    Hi Guys,

    having some issues while trying to display the current node am on and at same displaying the next node. Here i can make use of GetXmlNodeById since this section admin can create more and more section.

    Here is my xslt 

    <xsl:for-each select="$currentPage/ancestor-or-self::*[@isDoc]/descendant-or-self::*[@isDoc and @level = $currentPage/@level]">
       
         <xsl:element name="li">       
              <href="{umbraco.library:NiceUrl(@id)}">     
               <xsl:value-of select="@nodeName"/>
            </a>  
           </xsl:element>
    </xsl:for-each>

    My tree in content section is 

    Folder 1
      2011
      2012
    Folder 2
      2009
      2008

    Right now when am on node 2011 am getting all the sub nodes 2011, 2012, 2009 and 2008. The right ouput would be 2011 & 2012 whenever am on either those 2 nodes.

  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    Apr 12, 2012 @ 10:26
    Jeroen Breuer
    0

    Here is an example which get's the current employee. The employees are all at the same level and I use this code to go to the next or previous node which are at the same level:

    <!--Get the employee which needs to be displayed.-->
    <xsl:variable name="employee" select="umbraco.library:GetXmlDocumentByUrl(concat($mainUrl, $subitem/@script, '/', $language))/index/medewerkers/medewerker[id = $currentPage/@id]" />
    
    <!--Get the previous and next employee.-->
    <xsl:variable name="previousEmployee" select="$employee/preceding-sibling::*[1]"/>
    <xsl:variable name="nextEmployee" select="$employee/following-sibling::*[1]"/>

    Jeroen

  • Fuji Kusaka 2203 posts 4220 karma points
    Apr 12, 2012 @ 18:32
    Fuji Kusaka
    0

    Hi Jeroen,

    Thanks for the response, unfortunately i can get this working. What am trying to do is display all nodes from this current page, the current node am on and the next one just like you would do with a main navigation. So when am on folder 2011, i should also be able to navigate to 2012.

     

    //fuji

  • Fuji Kusaka 2203 posts 4220 karma points
    Apr 12, 2012 @ 19:48
    Fuji Kusaka
    0

    Got it working.  This is how i solved this

    <xsl:for-each select="$currentPage/../*[@isDoc][not(umbracoNaviHide = 1)]">
    
Please Sign in or register to post replies

Write your reply to:

Draft