[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Sorting by date
Excellent! Thank you very much for your help. --- Martin Honnen <Martin.Honnen@xxxxxx> wrote: > sudheshna iyer wrote: > > I am using xsl:stylesheet version="1.0". > > Here is an XSLT 1.0 stylesheet that produces the > result you described. > You only need to complete the "translation table" > for the months: > > <xsl:stylesheet > xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > xmlns:dt="http://example.com/2008/data" > version="1.0"> > > <xsl:output method="text"/> > > <data xmlns="http://example.com/2008/data"> > <month s="Jan" n="01"/> > <month s="Feb" n="02"/> > <month s="Mar" n="03"/> > <month s="Apr" n="04"/> > <!-- add other months here --> > </data> > > <xsl:template match="/"> > <xsl:apply-templates select="rss/channel/item"> > <xsl:sort data-type="number" > order="descending" > select="concat(substring(SortDate, 13, 4), > document('')/xsl:stylesheet/dt:data/dt:month[@s = > substring(current()/SortDate, 9, 3)]/@n, > substring(SortDate, 6, 2))"/> > </xsl:apply-templates> > </xsl:template> > > <xsl:template match="item"> > <xsl:value-of > select="concat(substring(SortDate, 13, 4), '-', > document('')/xsl:stylesheet/dt:data/dt:month[@s = > substring(current()/SortDate, 9, 3)]/@n, '-', > substring(SortDate, 6, 2), > ' ', title, ' ')"/> > </xsl:template> > > </xsl:stylesheet> > > > -- > > Martin Honnen > http://JavaScript.FAQTs.com/
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|