Copied to clipboard

Flag this post as spam?

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


  • Alec Colebrook-Clark 134 posts 258 karma points
    Jul 10, 2009 @ 12:13
    Alec Colebrook-Clark
    0

    Sibling Navigation

    Howdy

    I have built a sibling navigation that will create a link for any preceeding nodes, itself and finally any following sibling nodes. It looks right and each link says its pointing to the correct location except umbraco keeps saying it cant find the page. This leads me to believe that my syntax is wrong so if anyone could have a quick glance would be much appreciated!

    My code is

    <xsl:for-each select="$currentPage/preceding-sibling::node [string(./data [@alias='umbracoNaviHide']) != '1']">
    <td>
    <a href="{umbraco.library:NiceUrl(@id)}">
    <xsl:attribute name="title"><xsl:value-of select="@nodeName" /></xsl:attribute>
    <xsl:value-of select="@nodeName" />
    </a>
    </td>
    </xsl:for-each>

    <td>
    <a href="{umbraco.library:NiceUrl($currentPage/@id)}">
    <xsl:attribute name="title"><xsl:value-of select="$currentPage/@nodeName" /></xsl:attribute>
    <xsl:value-of select="$currentPage/@nodeName" />
    </a>
    </td>

    <xsl:for-each select="$currentPage/following-sibling::node [string(./data [@alias='umbracoNaviHide']) != '1']">
    <td>
    <a href="{umbraco.library:NiceUrl(@id)}">
    <xsl:attribute name="title"><xsl:value-of select="@nodeName" /></xsl:attribute>
    <xsl:value-of select="@nodeName" />
    </a>
    </td>
    </xsl:for-each>

    its not the most gracefull but it should work!

    Thanks in Advance

    Alec

  • Vladimir Dobrov 45 posts 167 karma points
    Jul 10, 2009 @ 12:34
    Vladimir Dobrov
    100

    Alec,

    1.Concerning your xslt... preceding-sibling + self + following-sibling is actually the same as parent/child. So you can reduce the size of you code by changing your select expression to the following construction:

    $currentPage/parent::node/child::node[...............]

    2. What do you mean "Umbraco keeps saying it cant find the page" ?

  • Alec Colebrook-Clark 134 posts 258 karma points
    Jul 10, 2009 @ 12:43
    Alec Colebrook-Clark
    0

    Thanks! I'm still learning XSLT and best practices for it, so it really is much appreciated.

    As for the the umbraco I dont know what happened but i have fixed it. Its a bit strange but Umbraco couldnt locate the actual file. It could pull out all the information from the node but when I tried to navigate to the corresponding page it said the was no existing page/node.

     

    Alec

  • Vladimir Dobrov 45 posts 167 karma points
    Jul 10, 2009 @ 12:51
    Vladimir Dobrov
    0

    You're welcome =)

    May be there was some kind of Publish issues...

  • Alec Colebrook-Clark 134 posts 258 karma points
    Jul 10, 2009 @ 13:19
    Alec Colebrook-Clark
    0

    yeah thats what i was thinking...

Please Sign in or register to post replies

Write your reply to:

Draft