Copied to clipboard

Flag this post as spam?

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


  • savantKing99 70 posts 120 karma points
    May 23, 2013 @ 22:47
    savantKing99
    0

    sort on date

    Hi everybody,

     

    I try to sort on Date.

    I try it like this:

    <!-- The fun starts here -->
        <ul>
          <xsl:for-each select="$currentPage/* [@isDoc and string(umbracoNaviHide) != '1']">
            <li>
               
                <b>Publicatie Datum:</b>&nbsp;<xsl:value-of select="umbraco.library:FormatDateTime(./publicatieDatum,'dd/MM/yyyy')" order="ascending"/>

    THX,

    Niels

  • Chriztian Steinmeier 2800 posts 8790 karma points MVP 8x admin c-trib
    May 23, 2013 @ 23:48
    Chriztian Steinmeier
    100

    Hi Niels,

    You use a sort instruction immediately after the for-each to do that, like this:

    <ul>
        <xsl:for-each select="$currentPage/* [@isDoc and string(umbracoNaviHide) != '1']">
            <xsl:sort select="publicatieDatum" data-type="text" order="ascending" />
            <li>
                <b>Publicatie Datum:</b>
                <xsl:value-of select="umbraco.library:FormatDateTime(publicatieDatum, 'dd/MM/yyyy')" />
            </li>
        </xsl:for-each>
    </ul>

    This way, you can use more than one sort option, e.g., you could sort first by date and then by name (so that entries from the same date would be sorted alphabetically):

    <xsl:sort select="publicatieDatum" data-type="text" order="ascending" />
    <xsl:sort select="@nodeName" data-type="text" order="ascending" />

    /Chriztian

  • savantKing99 70 posts 120 karma points
    May 24, 2013 @ 07:27
    savantKing99
    0

    Thanks Chriztian

Please Sign in or register to post replies

Write your reply to:

Draft