title: Sort list of objects in Velocity template - Liferay
body: <p>I've created a structure in Liferay as below</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;root&gt;
        &lt;dynamic-element name='header' type='text' index-type='' repeatable='true'&gt;
          &lt;dynamic-element name='headerlink' type='text' index-type='' repeatable='false'&gt;       &lt;/dynamic-element&gt;
          &lt;dynamic-element name='location' type='text' index-type='' repeatable='false'&gt;  &lt;/dynamic-element&gt;
          &lt;dynamic-element name='description' type='text_box' index-type='' repeatable='false'&gt;  &lt;/dynamic-element&gt;
          &lt;dynamic-element name='date' type='text' index-type='' repeatable='false'&gt;&lt;/dynamic-element&gt;
        &lt;/dynamic-element&gt;
  &lt;/root&gt;
  </code></pre>
  
  <p>Now header repeatable block, I have 4-5 element blocks as same. Each one of have different "date" value inside it. "date" is simple text type. date format is (dd/mm/yyyy)</p>
  
  <p>Now I want to display all the element in sorting order based on the date entered.</p>
  
  <p>My template is as below.</p>
  
  <pre><code>&lt;ul&gt;
                  #set($count = 0)
                  #foreach( $nm in $header.getSiblings())
                      #set($content="content"+$count)
                      &lt;li id="$content"&gt;
                          &lt;div class="event"&gt;
                          #set($monthnameid="month"+$count)
                          #set($dayid="day"+$count)
                          &lt;p class="date-section"&gt;
                              &lt;span class="month" id="$monthnameid"&gt;$nm.date.data&lt;/span&gt;
                              &lt;span class="date" id="$dayid"&gt;&lt;/span&gt;
                          &lt;/p&gt;
                          &lt;p class="event-detail-section"&gt;
                              #if($nm.headerlink.data !="")
                                  &lt;span class="event-title"&gt;&lt;a class="event-link" href="$nm.headerlink.data"&gt;$nm.data&lt;/a&gt;&lt;/span&gt;
                              #else
                                  &lt;span class="event-header"&gt;$nm.data&lt;/span&gt;
                              #end
  
                              #if($nm.description.data.toString().length() &gt;100)
                                  &lt;span class="event-description"&gt;$nm.description.data.toString().substring(0,100)&lt;/span&gt;
                              #else
                                  &lt;span class="event-description"&gt;$nm.description.data.toString()&lt;/span&gt;
                              #end
                              &lt;span class="event-location"&gt;Location: $nm.location.data&lt;/span&gt;
                          &lt;/p&gt;
                      &lt;/div&gt;
                  &lt;/li&gt;
                  #set($count = $count +1)
              #end
              &lt;/ul&gt;
  </code></pre>
  
  <p>I am not aware regarding how can we sort object inside velocity.</p>
  
  <p>Any help on this would be much appreciated.</p>