Note that there are some explanatory texts on larger screens.

plurals
  1. POSorting in xslt with datetime from xml?
    text
    copied!<p>i want to sorting by descending order based on date.i dont know how to accomplish this :</p> <p>Here is my xml : </p> <pre><code>&lt;?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?&gt; &lt;inm:Results productTitle="Inmagic DB/Text WebPublisher PRO" productVersion="13.00" xmlns:inm="http://www.inmagic.com/webpublisher/query" oex="ISO-8859-1"&gt; &lt;inm:Recordset AC="QBE_QUERY" sn="AUTO26264" se="1392" queryCount="139" page="1" pageCount="1" setCount="139"&gt; &lt;inm:Record setEntry="0"&gt; &lt;inm:Title&gt;BBBBBB&lt;/inm:Title&gt; &lt;inm:Pub_Date&gt;12-Jun-2012&lt;/inm:Pub_Date&gt; &lt;inm:Words /&gt; &lt;/inm:Record&gt; &lt;inm:Record setEntry="1"&gt; &lt;inm:Title&gt;TESTING ESTING&lt;/inm:Title&gt; &lt;inm:Pub_Date&gt;12-jul-2012&lt;/inm:Pub_Date&gt; &lt;inm:Words /&gt; &lt;/inm:Record&gt; &lt;inm:Record setEntry="2"&gt; &lt;inm:Title&gt;TESFDS SDFASDFASDt&lt;/inm:Title&gt; &lt;inm:Pub_Date&gt;30-Jun-2012&lt;/inm:Pub_Date&gt; &lt;inm:Words /&gt; &lt;/inm:Record&gt; &lt;/inm:Recordset&gt; &lt;/inm:Results&gt; </code></pre> <p>and my xml is :</p> <pre><code> &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:inm="http://www.inmagic.com/webpublisher/query"&gt; &lt;xsl:output method="html"/&gt; &lt;xsl:template match="/"&gt; &lt;ul class="baseList newsList"&gt; &lt;xsl:for-each select="inm:Results/inm:Recordset/inm:Record" &gt; &lt;xsl:sort select="inm:Pub_Date" order="descending"/&gt; &lt;li&gt; &lt;span class="title"&gt; &lt;a href="#"&gt; &lt;xsl:value-of select="inm:Title" /&gt; &lt;/a&gt; &lt;/span&gt; &lt;p class="meta"&gt; &lt;span class="dateTime"&gt; &lt;xsl:value-of select="inm:Pub_Date"/&gt; &lt;/span&gt; &lt;/p&gt; &lt;/li&gt; &lt;/xsl:for-each&gt; &lt;/ul&gt; &lt;/xsl:template&gt; </code></pre> <p></p> <p>i try to sorting in xslt script but its not worked perfectly.</p> <p>output was : - 30-Jun-2012 - 12-jul-2012 - 12-jun-2012</p> <p>but output should be : -12-jul-2012 -30-jun-2012 -12-Jun-2012</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload