Copied to clipboard

Flag this post as spam?

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


  • Stephen 204 posts 246 karma points
    Aug 30, 2011 @ 13:50
    Stephen
    0

    Content displays on home page but not child of home

    Hey all

    I have the following structure

    Home

    >>>> content page

    >>>> content page

    >>>> usefull links (this has a doc type of "textpage"

              >>>>>>>> link item 1 (doctype "tmLinksPage"

              >>>>>>>> link item 2 (doctype "tmLinksPage"

    and using the following code i can prodcuce a list of link items on the home page but when i navigate to child page of home they dont appear...

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE xsl:stylesheet [
        <!ENTITY nbsp "&#x00A0;">
    ]>
    <xsl:stylesheet
      version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:msxml="urn:schemas-microsoft-com:xslt"
      xmlns:umbraco.library="urn:umbraco.library"
      exclude-result-prefixes="msxml umbraco.library">


        <xsl:output method="xml" omit-xml-declaration="yes"/>

        <xsl:param name="currentPage"/>
        
        <xsl:variable name="noOfItems" select="5" />
        <xsl:param name="MaxNoChars" select="25" />
        <xsl:template match="/">
        
           <h2>Usefull Links</h2>
           <ul>
            
             <xsl:for-each select="$currentPage//ancestor-or-self::tmLinksPage[@isDoc]">
                    <xsl:sort select="@createDate" order="ascending"/>  
                     <li>
                       <a href="{umbraco.library:StripHtml(current()/linkURL)}" target="_blank" Title="Click here to visit {umbraco.library:StripHtml(current()/linkTitle)}"><xsl:value-of select="umbraco.library:TruncateString(umbraco.library:StripHtml(current()/linkTitle), $MaxNoChars, '...')" /></a>
                     </li>
                  
                </xsl:for-each>
              
        </ul>
          <p><a href="">View all</a></p>
        </xsl:template>

    </xsl:stylesheet>

    any ideas?

  • Dirk De Grave 4537 posts 6006 karma points MVP 3x admin c-trib
    Aug 30, 2011 @ 14:58
    Dirk De Grave
    0

    need to change your for-each construct

     <xsl:for-each select="$currentPage/ancestor-or-self::* [@level = '1']//* [name() = 'tmLinksPage'">

    so, using above construct, you're always first travelling up site, starting from currentPage, up to node at level 1 (which will be your 'Home' page), and then search for all documents of type tmLinksPage

     

    Hope this helps.

    Regards,

    /Dirk

     

     

     

     

     

  • Stephen 204 posts 246 karma points
    Aug 30, 2011 @ 16:19
    Stephen
    0

    Just a small type Dirk (missing a closing ]), thanks for the post..

     

    <xsl:for-eachselect="$currentPage/ancestor-or-self::* [@level = '1']//* [name() = 'tmLinksPage']">
  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies