Hi guys. I am relatively new to XSLT, and I am trying to create a navigation that shows the next article in a menu (should traverse all items).
I have the following site structure:
Blog
-- Video 01
-- Video 02
-- Video 03
-- Article 01
-- Article 02
-- Article 03
-- Article 04
-- Another page
-- Last page
The link that I get should traverse all items downwards, and if it reaches the end it should go up to its parent and show the following-sibling. I found it easy to navigate downwards, I did by checking if there are any descendants, and then show next descendant in line.
My problem is that I don't know how to check for the parents sibling recursively (regardless of how many levels up it should go).
I tried the following for each:
<xsl:for-each select="Page[@ID = //GlobalTags/Global.Page.ID]/ancestor::*/following-sibling::Page[1]"> <xsl:value-of select="@FriendlyHref"/> </xsl:for-each>
But this will output all following-siblings, and I just need the @FriendlyHref from the next sibling. I tried creating a variable to stop the loop after the first run, but it didn't work.
Does anyone know what I am doing wrong?
Thanks a lot in advance.