Copied to clipboard

Flag this post as spam?

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


  • Dan 1288 posts 3942 karma points c-trib
    Aug 17, 2010 @ 14:20
    Dan
    0

    Preceding sibling

    Hi,

    I have the following structure:

    - Home
    - - Category1
    - - - Sub-category1
    - - - Sub-category2
    - - - Sub-category3
    - - Category2
    - - - Sub-category4
    - - - Sub-category5

    I want to put 'previous' and 'next' buttons on the sub-category pages, so if you're on the sub-category2 page you'll get a previous link taking to you sub-category1 and a next link taking you to sub-category3, for example.  If on sub-category3 you only get a back button.

    The next link seems to be working fine (just showing node name, not link, for simplicity):

    <xsl:value-of select="$currentPage/following-sibling::* [@isDoc]/@nodeName"/>

    However, the previous link is causing some grief.  It seems to always link to the first sibling (e.g. Sub-category1, even when I'm on the Sub-category3 page).

    <xsl:value-of select="$currentPage/preceding-sibling::* [@isDoc]/@nodeName"/>

    Can anyone see how to resolve this so it always retreives the sibling node immediately preceding the current page?

    Thanks

  • Sebastiaan Janssen 5061 posts 15544 karma points MVP admin hq
    Aug 17, 2010 @ 14:48
    Sebastiaan Janssen
    2

    That's not exactly what it does, it gets ALL of the preceding sibblings (see: http://pimpmyxslt.com/axesviz.aspx?contextNode=1073&axis=preceding-sibling#screen).

    I think you could change it to this and it should work (select just the first one from the results):

    <xsl:value-of select="$currentPage/preceding-sibling::* [@isDoc][1]/@nodeName"/>
  • Dan 1288 posts 3942 karma points c-trib
    Aug 17, 2010 @ 14:58
    Dan
    0

    Yep, that does it, thanks Sebastian.  I thought I was gonna have to get all 'muenchian' for a moment there ;)

  • 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