Copied to clipboard

Flag this post as spam?

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

  • Roger 195 posts 474 karma points
    Mar 05, 2015 @ 18:27

    XSLT Sort Issue

    Hi all, this is probably really simple but...

    I have an XSLT sort for records to show descending

    <xsl:sort select="@id" order="descending"/>

    The records in the database have now reached over 1000 and the sort has stopped at 999 records.

    Here's the full XSLT:

    <xsl:variable name="comments" select="UCommentLibrary:GetCommentsForNode($currentPage/@id)//comment"/>
        Showing 100 of <xsl:value-of select="count($comments)"/> comment<xsl:if test="count($comments) &gt; 1">s</xsl:if>  in our  <xsl:value-of select="$currentPage/@nodeName"/>
      <ol class="commentlist">
        <xsl:for-each select="$comments">
            <xsl:sort select="@id" order="descending"/>
        <xsl:if test="position() &lt;= 100">
          <li class="comment" id="comment-{@id}">
            <div class="comment-author">
              <span class="fn n">
                        <xsl:value-of select="./name"/>
            <div class="comment-meta">
              Posted <xsl:value-of select="umbraco.library:LongDate(@created,'true',' at ')"/>
              <xsl:value-of select="umbraco.library:ReplaceLineBreaks(./message)" disable-output-escaping="yes"/>

    Can anyone help please?

    many thanks!

  • Chriztian Steinmeier 2741 posts 8406 karma points MVP 6x admin c-trib
    Mar 05, 2015 @ 18:42
    Chriztian Steinmeier

    Hi Roger,

    Could very well just be that you need to tell the processor to sort numerical (the default is "text" - so you'll find item #1000 at the very end when sorting using descending) - try this:

    <xsl:sort select="@id" data-type="number" order="descending" />


  • Roger 195 posts 474 karma points
    Mar 06, 2015 @ 16:53

    Thanks Chriztian, worked perfectly :)

Please Sign in or register to post replies

Write your reply to: