Copied to clipboard

Flag this post as spam?

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


  • Bram Loquet 72 posts 102 karma points
    Aug 17, 2010 @ 15:58
    Bram Loquet
    0

    get distinct years based on @createDate

           Is there a way to something similar to this to get the distinct years for published nodes?

    <xsl:variable name="list" select="umbraco.library:GetXmlNodeById(10)//* [name() = 'NewsItemDoctype']" />

    <
    xsl:variable name="uniquelist" select="$list//umbraco.library:FormatDateTime(@createDate,
    'yyyy')[not(.=following::umbraco.library:FormatDateTime(@createDate,
    'yyyy'))]"
    />

    <xsl:for-each select="$uniquelist">
    <xsl:value-of select="."/>
    </xsl:for-each>

     

  • Jeff Grine 149 posts 189 karma points
    Aug 17, 2010 @ 17:58
    Jeff Grine
    0

    This worked for me:

        <xsl:variable name="years" select="$currentPage/node[not(preceding-sibling::node/data [@alias = 'issueYear'] = data [@alias = 'issueYear'])]/data [@alias = 'issueYear']" />
    
    Not based on @createDate, but you get the idea.

     

  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    Aug 17, 2010 @ 18:11
    Sebastiaan Janssen
    1

    I think this is a case for the so-called Muenchean method. Personally, I would just write an XSLT extension too much logic for XSLT to handle really.

  • Richard Soeteman 4046 posts 12899 karma points MVP 2x
    Aug 17, 2010 @ 19:20
    Richard Soeteman
    0

    +1 for Sebastiaans suggestion. When first starting with Umbraco I ended up with a very messy XSLT and refactored that to a single human readable line in c# :P

Please Sign in or register to post replies

Write your reply to:

Draft