[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Date formatting using XSLT extensions functions

Subject: RE: Date formatting using XSLT extensions functions
From: Jarno.Elovirta@xxxxxxxxx
Date: Mon, 28 Apr 2003 11:18:57 +0300
pure xslt date formatting
Hi,

> I have an input date in a format like this: 13/03/2003 
> 4:58:32 pm which I'd
> like to format into the following: 13 March
> 
> I have tried the following two extension functions, without 
> success I'm
> afraid. The first uses VBScript and the second JavaScript. I haven't

Pure XSLT would be something like

<xsl:template match="/">
  <xsl:variable name="x" select="'13/03/2003 4:58:32 pm'" />
  <xsl:value-of select="substring-before($x, '/')" />
  <xsl:text> </xsl:text>
  <xsl:value-of select="document('')/*/x:months/month[@number = format-number(substring-before(substring-after($x, '/'), '/'), '##')]/@name" />
</xsl:template>

<x:months>
  <month name="January" number="1" />
  <month name="February" number="2" />
  <month name="March" number="3" />
  <month name="April" number="4" />
  <month name="May" number="5" />
  <month name="June" number="6" />
  <month name="July" number="7" />
  <month name="August" number="8" />
  <month name="September" number="9" />
  <month name="October" number="10" />
  <month name="November" number="11" />
  <month name="December" number="12" />
</x:months>

but you can also use <http://exslt.org/date/index.html> if your processors support EXSLT date and time module.


Cheers,

Jarno -  Lights Of Euphoria: True Life (VNV Nation)

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.