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

Re: formatting dates/times in XSL

Subject: Re: formatting dates/times in XSL
From: Goetz Bock <bock@xxxxxxxxxxx>
Date: Tue, 30 Oct 2001 10:47:46 +0100
xsl formatting dates
On Mon, Oct 29 '01 at 22:17, Todd Binder wrote:
> Is there a way to format dates and times in XSL?  currently I have date and
No, but you can easily write one
> time elements in the XML sourcefile
> 
> <date>20011011</date>
<xsl:template match="date">
  <xsl:variable name="month" select="substring(.,5,2)"/>
  <xsl:value-of 
       select="document('')//my:monthnames/my:month[position()=$month]"/>
  <xsl:text> </xsl:text>
  <xsl:value-of select="substring(.,7,2)"/>
  <xsl:text>, </xsl:text>
  <xsl:value-of select="substring(.,1,4)"/>
</xsl:template>

with

<my:monthnames>
  <my:month>Januar</my:month>
  <my:month>Februar</my:month>
  <my:month>March</my:month>
  <!-- ... -->
  <my:month>December</my:month>
</my:monthnames>

somewhere in the beginning of your stylesheet
> <time>14:00</time>
> 
> and with XSL, I would like to format the date as MMM DD, YYYY (i.e. October
> 11, 2001) and format the time in the format of 2 pm
I will not tell you how to converte time to this wired american format, as I 
only support "military" time. (Germany and most of Europa does only use 
"military" time)
-- 
Goetz Bock                                              IT Consultant
Dipl.-Inf. Univ.

Attachment: pgp00022.pgp
Description: PGP signature

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.