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

Re: Date conversion

Subject: Re: Date conversion
From: Steven.C.Kienle@xxxxxxxxxx
Date: Wed, 1 Aug 2001 12:23:41 -0400
xslt date conversion
  I responded once, but to give a more "complex" solution:
  
  <?xml version='1.0' encoding='utf-8' ?>
  <xsl:stylesheet version="1.0" 
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:months="months.uri">
  
  <xsl:output method="text" />
  
  
  <months:month abbr="Jan" num="01"/>
  <months:month abbr="Feb" num="02"/>
  <months:month abbr="Mar" num="03"/>
  <months:month abbr="Apr" num="04"/>
  <months:month abbr="May" num="05"/>
  <months:month abbr="Jun" num="06"/>
  <months:month abbr="Jul" num="07"/>
  <months:month abbr="Aug" num="08"/>
  <months:month abbr="Sep" num="09"/>
  <months:month abbr="Oct" num="10"/>
  <months:month abbr="Nov" num="11"/>
  <months:month abbr="Dec" num="12"/>
  
  <xsl:variable name="the-months" select="document('')/*/months:month" 
  />
  
  <xsl:template match="//date">
  
  <xsl:value-of select="$the-months[@abbr = substring(current(), 4, 
  3)]/@num" />
  <xsl:text>/</xsl:text>
  <xsl:value-of select="substring(text(), 1, 2)" />
  <xsl:text>/</xsl:text>
  <xsl:value-of select="substring(text(), 8, 4)" />
  </xsl:template>
  
  </xsl:stylesheet>
  
  This uses the document function to pull in the lookup table from the 
  stylesheet itself.  Then the select state find the correct month 
  number using a xpath query.
  

______________________________ Reply Separator _________________________________
Subject:  Date conversion
Author:  xsl-list@xxxxxxxxxxxxxxxxxxxxxx at Internet-America
Date:    01-08-2001 9:45 AM


The format of the date returned in my XML is 17-Dec-2000 07:23:31 I need to 
display the date as 12/17/2000.

How do I do this using xsl?

Thanks,
Katie

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp


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


 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.