J'essaie de trier par date pour la sortie XML. Voici mon XSL:Trier par date dans XSL
<?xml version="1.0" encoding="UTF-8"?>
<!-- Example by Phil 'iwonder' Guerra -->
<!-- Edited by Lee Sykes DNN Creative Magazine http://www.dnncreative.com -->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" indent="yes"/>
<xsl:param name="TITLE"/>
<xsl:template match="rss">
<!-- Do not show channel image -->
<!-- Do not select the first item (this is useful if there are advertisements, such as using an RSS feed from moreover.com-->
<xsl:for-each select="channel/item[position() > 0]">
<!-- Test to limit number of items displayed. Here only 5 items will be transformed -->
<xsl:if test="position() < 5">
<br></br>
<!-- to open links in a new window, change target="_main" to target="_blank" -->
<strong><a href="{link}" target="_blank"><xsl:value-of select="title"/></a></strong>
<br>
<!-- <xsl:value-of select="pubDate"/> -->
</br>
<!-- only display 100 characters of the description, and allow html -->
<xsl:value-of disable-output-escaping="yes" select="description"/>
</xsl:if>
</xsl:for-each>
</xsl:template>
<xsl:template match="description">
<br>
<xsl:value-of select="."/>
</br>
</xsl:template>
<xsl:template name="strip-tags">
<xsl:param name="text"/>
<xsl:choose>
<xsl:when test="contains($text, '<')">
<xsl:value-of select="substring-before($text, '<')" />
<xsl:call-template name="strip-tags">
<xsl:with-param name="text" select="substring-after($text, '>')"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="substring($text, 1, 100)" />
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
Je suis en train de trier par ordre décroissant en utilisant le entereddate dans mon XML:
<item>
<title>Media Director</title>
<entereddate>4/2/2009</entereddate>
<referencenumber>01646359</referencenumber>
<description><![CDATA[Leading Cleveland-based Award-Winning Integrated Marketing Communications firm seeks a passionate Media Director to lead a team of media planning and buying professionals and Fortune 500 clients. This individual will be responsible to develop strategic and innovative traditional and nontraditional consumer engagement solutions including emerging media. This leader will play a large role in new business. Ten years experience in media planning and buying as well as five years of management required. The environment is collaborative with many creative perks.]]></description>
<city>Cleveland</city>
<state>OH</state>
<country>United States of America</country>
<salary>$0.00 - $0.00/$0.00/hr - $0.00/hr</salary>
<guid isPermaLink="false">http://employment.topechelon.com/web77391/jobseeker/sSetup.asp?runsearch=1&spJobAdId=01646359</guid>
<link>http://employment.topechelon.com/web77391/jobseeker/sSetup.asp?runsearch=1&spJobAdId=01646359</link>
</item>
Toute aide serait appréciée!
Merci
Dans quel format se trouve cette date? - C'est à dire. Est-ce le 4 février 2009 ou le 2 avril 2009? –
4/2/2009 - Merci – bethhilson
Le 4 février alors? –