Copied to clipboard

Flag this post as spam?

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


  • Claus Nedergaard 62 posts 104 karma points
    Feb 15, 2011 @ 14:50
    Claus Nedergaard
    0

    Show news on fontpage

    Hi all! Iv'e been struggling with upgrading my newslist  to the new schema.

    The xslt saves fine but genereats no output at all. Only the <ul> tag gets generated in the browser.

    I have my newspage (total overview) on level 1 with the news items below that.

    The page with the newslist is also on level 1.

            
    <xsl:variable name="SortOrder" select="$currentPage/ancestor-or-self::* [@isDoc and @level = 1]//* [@isDoc and @nodeTypeAlias = 'ndmNyhederAktivitetsListe']/sortOrder" /> 
    <xsl:variable name="SortBy" select="$currentPage/ancestor-or-self::* [@isDoc][@level=1]//* [@isDoc and @nodeTypeAlias = 'ndmNyhederAktivitetsListe']/sortBy" />
    <xsl:variable name="NumberofItemsToDisplay" select="$currentPage/antalNyhederForsiden" />
    <xsl:template match="/">
    <xsl:variable name="DataType">  
        <xsl:choose> 
            <xsl:when test="$SortBy='sortOrder'"> 
                <xsl:value-of select="'number'" /> 
            </xsl:when> 
            <xsl:otherwise> 
                <xsl:value-of select="'text'" /> 
            </xsl:otherwise> 
        </xsl:choose> 
    </xsl:variable>
           

    <ul id="NewsList">
    <xsl:for-each select="$currentPage/ancestor-or-self::* [@isDoc and @level = 1]//* [@isDoc and @nodeTypeAlias = 'ndmNyhederAktivitetsListe'] [string(umbracoNaviHide) != '1']">
    <xsl:sort select="@*[name() = $SortBy]" order="{$SortOrder}" data-type="{$DataType}"/>
     <xsl:if test="position()&lt;= $NumberofItemsToDisplay">  
      <xsl:variable name="Class">  
       <xsl:choose> 
        <xsl:when test="@nodeTypeAlias='ndmAktivitet'"> 
         <xsl:value-of select="'ndmAktivitet'" /> 
        </xsl:when> 
        <xsl:otherwise> 
         <xsl:value-of select="'ndmNyhed'" /> 
        </xsl:otherwise> 
       </xsl:choose> 
      </xsl:variable>
      <li class="{$Class}">
       <a title="{@nodeName}" href="{umbraco.library:NiceUrl(@id)}">
        <strong><xsl:value-of select="@nodeName"/></strong><br/>
        <xsl:if test="./@updateDate !=''">    
         <em><xsl:value-of select="umbraco.library:FormatDateTime(./@updateDate, 'd. MMMM yyyy, ')"/></em>
        </xsl:if> <xsl:value-of select="@writerName"/>
       </a>
      </li>
     </xsl:if>
    </xsl:for-each>
    </ul>
    </xsl:template>
    </xsl:stylesheet>

    Please advice.

    Thanks in advance.

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Feb 15, 2011 @ 15:27
    Jan Skovgaard
    0

    Hi Claus

    I think it's the @nodeTypeAlias that is bugging you here. Since the elements are named after the nodeTypeAlias it's not an attribute in the XML anymore.

    So therefore I think you should try and change your expression from

             <xsl:variable name="SortOrder" select="$currentPage/ancestor-or-self::* [@isDoc and @level = 1]//* [@isDoc and @nodeTypeAlias = 'ndmNyhederAktivitetsListe']/sortOrder" /> 

    to

             <xsl:variable name="SortOrder" select="$currentPage/ancestor-or-self::* [@isDoc and @level = 1]//* [@isDoc and ndmNyhederAktivitetsListe]/sortOrder" />

    Try it out and see if it's working for you. And do remember to change it everywhere you make use of the @nodeTypeAlias attribute.

    /Jan

  • kows 81 posts 151 karma points c-trib
    Feb 15, 2011 @ 15:30
    kows
    0

    if above doesn't work maybe (also think its @nodeTypeAlias) :

    name() = 'ndmNyhederAktivitetsListe'

  • Claus Nedergaard 62 posts 104 karma points
    Feb 15, 2011 @ 16:52
    Claus Nedergaard
    0

    Thanks guys...you are lifesavers :-)

    Turned out you were both spot on. the nodeTypeAlias was the culprit.

    Tried Jans proposal first and the xslt file saved ok - but still no output. But using kows expression was the one that worked for me.

    Thanks! 

  • 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