|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: sort by date
might also have some luck using www.exslt.org date/time templates gl, jim fuller > At 10:16 AM 11/26/2002, you wrote: >> <a4013 date="1998-01-03T00:00:00">FRUTAS</a4013> >> >>the "T00:00:00" has no use but some one can point an >>idea to get the desired sort by date? > > The quickest to write and easiest to use IMO would be to use >substring-before() and substring-after() to pick apart the date into >pieces you want. For example, > <xsl:template name="my-date"> > <xsl:param name="date" value="''"/> > <xsl:if test="$date"> > <xsl:variable name="year" select="substring-before($date, '-')" /> > <xsl:variable name="month" select="substring-before( > substring-after($date, > '-'), > '-')" /> > <xsl:variable name="day" select="substring-before( > substring-after( > substring-after($date, > '-'), > '-'), > 'T')" /> > <!-- Display date components however you'd like --> > <!-- This one produces MM/DD/YY --> > <xsl:value-of select="$month" /> > <xsl:text>/</xsl:text> > <xsl:value-of select="$day" /> > <xsl:text>/</xsl:text> > <xsl:value-of select="substring($year, 2)" /> > <xsl:if> > </xsl:template> > > and call it with something like > > <xsl:call-template name="my-date"> > <xsl:with-param name="date" select="/a4013-list/a4013[1]/@date" /> > </xsl:call-template> > > I'm sure that there are other examples out there for transforming 12 > > into 'December' and other niceties. > > > Greg Faron > Integre Technical Publishing Co. > > > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
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
|

Cart








