Copied to clipboard

Flag this post as spam?

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


  • bowling 4 posts 24 karma points
    Feb 26, 2012 @ 19:45
    bowling
    0

    Secondary node of Related Link

    I created related link and display by use XSLT like:

      <ul class="footer-menu1" >
      <xsl:for-each select="$currentPage/ancestor-or-self::* [@isDoc][@level=1]/* [name() = 'navigationRelatedlink' and not(@isDoc)]/links/link">
                   <li>
                            <xsl:element name="a">
                                    <xsl:if test="./@newwindow = '1'">
                                            <xsl:attribute name="target">_blank</xsl:attribute>
                                    </xsl:if>
                                    <xsl:choose>
                                            <xsl:when test="./@type = 'external'">
                                                    <xsl:attribute name="href">
                                                            <xsl:value-of select="./@link"/>
                                                    </xsl:attribute>
                 
                                            </xsl:when>
                                            <xsl:when test="./@type = 'media'">
                                                    <xsl:attribute name="href">
                                                            <xsl:value-of select="umbraco.library:GetMedia(./@link, 0)/umbracoFile" />
                                                    </xsl:attribute>
                                            </xsl:when>
                                            <xsl:otherwise>
                                                    <xsl:attribute name="href">
                                                            <xsl:value-of select="umbraco.library:NiceUrl(./@link)"/>
                                                    </xsl:attribute>
                                            </xsl:otherwise>
                                    </xsl:choose>
                                    <xsl:value-of select="./@title"/>
                            </xsl:element>
     
      
      <!-- Child node of relate link -->

        #####I want to display all child nodes of each related link ######

      <!-- Child node of relate link -->
                     
           </li>
            </xsl:for-each>
     </ul>

     

    Is there anyway to show that child node of each related link?

    Please help me .

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Feb 26, 2012 @ 20:37
    Tom Fulton
    0

    Hi,

    I'm assuming you'll only show child nodes if the related links is of type "internal" - correct?  In that case you can use GetXmlNodeById to get the selected node, and then loop through it's children:

    <xsl:if test="@type = 'internal'">
      <xsl:variable name="selectedNodeChildren" select="umbraco.library:GetXmlNodeById(@link)/* [@isDoc]" />
      <xsl:if test="$selectedNodeChildren">
        <ul>
        <xsl:for-each select="$selectedNodeChildren">
          <li>
            <a href="{umbraco.library:NiceUrl(@id)}">
              <xsl:value-of select="@nodeName"/>
            </a>
          </li>
        </xsl:for-each>
        </ul>
      </xsl:if>
    </xsl:if>

    -Tom

  • bowling 4 posts 24 karma points
    Feb 27, 2012 @ 04:18
    bowling
    0

    wonderfullllll!!! I can display a child node.

    I stuck in this problem for 3 days . 

    Many thanks Tom :) 

Please Sign in or register to post replies

Write your reply to:

Draft