Copied to clipboard

Flag this post as spam?

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


  • Vincent Ashby-Smith 67 posts 196 karma points
    Jan 20, 2010 @ 11:39
    Vincent Ashby-Smith
    0

    Help with news xslt

    Hi all i'm tearing my hair out with this one, so wonder if anyone could help. I have a news section on my website set up in the following structure:

    1 News & Events

    1.1 News List

    1.1.1 2010

    1.1.1.1 January

    1.1.1.1.1 News Item 1

    1.1.2 2009

    1.1.2.1 January

    1.1.2.1.1 News Item 1

     

    What i want my xslt to do is select only the news items from 2009 if your on the 2009 page and 2010 if your on the 2010 page, currently this piece of xslt just lists all news items:

     

        <xsl:for-each select="$currentPage/ancestor-or-self::node//node [@nodeTypeAlias ='Proactis News Item']">
            <h2><xsl:value-of select="@nodeName"/></h2>
            <p><xsl:value-of select="data [@alias='shortDescription']"/></p>
            <xsl:choose>
              <xsl:when test="string(data [@alias='newsReleaseDate']) != ''">
                <p><xsl:value-of select="umbraco.library:FormatDateTime(data [@alias='newsReleaseDate'], 'dddd dd MMMM yyyy')"/></p>
              </xsl:when>
              <xsl:otherwise>
                <p><xsl:value-of select="umbraco.library:FormatDateTime(@createDate, 'dddd dd MMMM yyyy')"/></p>
              </xsl:otherwise>
            </xsl:choose>
            <p><a href="{umbraco.library:NiceUrl(@id)}" title="Read more">&#187; Read more</a></p>        
            </xsl:for-each>

     

    Any help would be much appreciated!!

     

  • Harald Ulriksen 207 posts 249 karma points
    Jan 20, 2010 @ 11:58
    Harald Ulriksen
    0

    If $curretPage is the 2009 page you should be able to use the following for-each select

    $currentPage//node[@nodeTypeAlias='Proactis News Item']


    hth,
    Harald

  • Vincent Ashby-Smith 67 posts 196 karma points
    Jan 20, 2010 @ 12:01
    Vincent Ashby-Smith
    0

    Cheers bud that did just the job, far simpler than i thought!!

Please Sign in or register to post replies

Write your reply to:

Draft