Copied to clipboard

Flag this post as spam?

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


  • Grant Stephen 18 posts 58 karma points
    Jan 04, 2012 @ 21:41
    Grant Stephen
    0

    Related links

    i have a parent node, Crew and child node crewMembers the crew members have a property which is a related link datatype, while i can render the links on the individual  crewMember page, I am trying to render all crewMembers details on the crew page , hers my last effort, 

    <ul>
    <xsl:for-each select="$currentPage/* [@isDoc and string(umbracoNaviHide) != '1']">
      <div id="crew">
        <ul>
          <li class="top-item"><h2<xsl:value-of select="@nodeName"/></h2></li>
          <li class="position-type"><xsl:value-of select="./role"/></li>
          <li><h4>Hometown</h4><xsl:value-of select="./homeTown"/></li>
          <li class="mid-item"><h4>Catch me at</h4>
            <xsl:call-template name="renderLinks" />
            
        
          </li>
          <li class="last-item"><h4>Bio</h4><xsl:value-of select="./bio"/></li>
        </ul>
      </div>
     
    </xsl:for-each>
    </ul>

    </xsl:template>
        <xsl:template name="renderLinks">
          
          <xsl:for-each select=" $currentPage/* [name() = $propertyAlias 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: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>
            </li>
          </xsl:for-each>
        </xsl:template>

     

     

  • Kim Andersen 1447 posts 2196 karma points MVP
    Jan 04, 2012 @ 23:03
    Kim Andersen
    0

    Hi Grant

    Could you try changing your for-each to this:

    <xsl:for-each select="$currentPage//* [name() = $propertyAlias and not(@isDoc)]/links/link">

    Just to see if this does render anything at all.

    /Kim A

  • Grant Stephen 18 posts 58 karma points
    Jan 04, 2012 @ 23:24
    Grant Stephen
    0

    Gave this try but it rendered everyones related links against ever crew member, 

     

    Grant

  • Kim Andersen 1447 posts 2196 karma points MVP
    Jan 04, 2012 @ 23:35
    Kim Andersen
    0

    Wasn't this what you wanted? To render all of the content from every related links properties on the Crew page? Or am I missing something obvious here? :)

    It's probably me who misunderstod your question, but could you try explain it in more details or in some other way maybe?

    /Kim A

  • Grant Stephen 18 posts 58 karma points
    Jan 04, 2012 @ 23:46
    Grant Stephen
    0

    what i'm looking for is something like:

    Jo Bloggs
    joe link 1 
    joe link 2  
    joe link 3

    Bob Smith
    bob link 1

    James Jones
    james link 1
    james link 2

    What i got when i changed the  for each

    was

    Jo Bloggs
    joe link 1 
    joe link 2  
    joe link 3
    bob link 1
    james link 1
    james link 2   

    Bob Smith
    joe link 1 
    joe link 2  
    joe link 3
    bob link 1
    james link 1
    james link 2  

    James Jones
    joe link 1 
    joe link 2  
    joe link 3
    bob link 1
    james link 1
    james link 2  

    Grant

  • Kim Andersen 1447 posts 2196 karma points MVP
    Jan 05, 2012 @ 00:02
    Kim Andersen
    0

    Ahh now I get it . Sorry :)

    I'm not sure the following will work, but could you try giving it a shot?:

    Chage the call-template to:

    <xsl:call-template name="renderLinks">
       <xsl:with-param name="id" select="@id" />
    </xsl:call-tempalte>

    And then change the first two lines of renderLinks to this:

    <xsl:template name="renderLinks">
          <xsl:param name="id" />
          <xsl:for-each select=" $currentPage/*[@id=$id and @isDoc]/* [name() = $propertyAlias and not(@isDoc)]/links/link">

    As I said, I'm not sure this will work, but what does this give you?

    /Kim A

  • Grant Stephen 18 posts 58 karma points
    Jan 05, 2012 @ 20:36
    Grant Stephen
    0

    no links rendered with this change, think I'll need to have a rethink

     

    G

Please Sign in or register to post replies

Write your reply to:

Draft