Copied to clipboard

Flag this post as spam?

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


  • gunjan 1 post 21 karma points
    Sep 23, 2011 @ 21:28
    gunjan
    0

    How to fetch content 3rd level data

    Hi

    I have created a structure in my Content like following: A is parent, B is child of A, C is child of B and C1 is child of C. All are of different document type.

    A

    ----B

    -------C

    -------------C1

    I want to fetch the value of property associated with C1. i am in C page xslt.

    i tried to get the data of C1 but failed. here is the code


    <xsl:variable name="items" select="$currentPage/ancestor-or-self::*[@isDoc and @level = 3]/* [@isDoc and string(umbracoNaviHide) != '1']"/>
    <xsl:if test="count($items) &gt; 0">
    <ul>
    <xsl:for-each select="$items">
    <li>
    <a href="{umbraco.library:NiceUrl(@id)}">
    <xsl:value-of select="@nodeName"/>
    </a>
    </li>
    <xsl:for-each select="$currentPage/node"/>
    </xsl:for-each>
    </ul>
    </xsl:if>

    Please let me know how to fetch the 3rd level data from 2nd page.

    Any help would be highlt appreciated

  • Lee Kelleher 4020 posts 15802 karma points MVP 13x admin c-trib
    Sep 26, 2011 @ 01:30
    Lee Kelleher
    0

    Hi Gunjan,

    If you want to be able to access the data at "C1" (level 4) from any other page level, then you will need to use the XPath to navigate up the nodes, then back down again, like so:

    <xsl:variable name="items" select="$currentPage/ancestor-or-self::*[@isDoc and @level = 1]/descendant::*[@isDoc and @level = 4 and string(umbracoNaviHide) != '1']"/>

    Cheers, Lee.

Please Sign in or register to post replies

Write your reply to:

Draft