Copied to clipboard

Flag this post as spam?

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


  • Michael Falch Madsen 70 posts 92 karma points
    Feb 24, 2011 @ 09:47
    Michael Falch Madsen
    0

    trouble with relatedLinks datatype

    I have a documentType with a property of type RelatedLink. I cant output the link in my XSLT.

     

    Im using Umbraco v 4.5.2

     

    DocumentType contains Question (Text), Answer (Text), RelatedLinks (relatedlinks)

    question and answer outputs fine...

     

    My XSLT:

    <div id="mythQuestions">
      <xsl:for-each select="$currentPage/* [name() = $documentTypeAlias and string(umbracoNaviHide) != '1']">
        <div id="mythQ" style="padding:5px; border:solid 1px #cdcdcd; width:170px;">
          <xsl:value-of select="question"/>
        </div>
        <div id="mythA" style="padding:5px; border:solid 1px #cdcdcd; width:170px;">
         <xsl:value-of select="answer"/>
          
          <div id="mythALinks">
            <xsl:value-of select="relatedLinks"/>      
          </div>      
        </div>
      </xsl:for-each>
    </div>

    From my Umbraco.config

    <MythQuestion id="1163" parentID="1154" level="4" writerID="0" creatorID="0" nodeType="1162" template="0" sortOrder="4" createDate="2011-02-24T09:12:37" updateDate="2011-02-24T09:14:07" nodeName="Question1" urlName="question1" writerName="Administrator" creatorName="Administrator" path="-1,1053,1107,1154,1163" isDoc="">
              <question><![CDATA[Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam sed purus ac eros feugiat bibendum. Donec eget dui eget mi dignissim vulputate non vitae nisi. Mauris dui diam, hendrerit ut facilisis vel, fermentum et lectus.?]]></question>
              <answer><![CDATA[Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam sed purus ac eros feugiat bibendum. Donec eget dui eget mi dignissim vulputate non vitae nisi. Mauris dui diam, hendrerit ut facilisis vel, fermentum et lectus.!]]></answer>
              <relatedLinks>
                <links>
                  <link title="Link1" link="1129" type="internal" newwindow="0" />
                </links>
              </relatedLinks>
              <umbracoNaviHide>0</umbracoNaviHide>
            </MythQuestion>

  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    Feb 24, 2011 @ 11:27
    Sebastiaan Janssen
    0

    You need to select all of the links, even if there's  only one, something like this should work:

    <xsl:for-each select="relatedLinks/links">
      <p><xsl:value-of select="@title" /></p>
      <xsl:comment />
    </xsl:for-each>
    
Please Sign in or register to post replies

Write your reply to:

Draft