Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: [xsl] Date conversion

From: Steven.C.Kienle@----------
To:
Date: 8/1/2001 8:32:00 AM
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: [xsl] 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


transparent
Print
Mail
Digg
delicious
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent