[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: "Dimitre Novatchev" <dnovatchev@xxxxxxxxx>
Date: Tue, 29 Apr 2003 06:57:26 +0200
date xsl
http://www.topxml.com/code/default.asp?p=3&id=v20021212030100


=====
Cheers,

Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL




"Kaine Varley" <kaine.varley@xxxxxxxxxxxxxxxxxx> wrote in message
news:D95333E1DFE4D511B30500065B39139B36EC84@xxxxxxxxxxx
> 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
> attempted to convert the month number to a name yet. Are the built script
> language functions and objects not available from the extensions?
>
> VBScript version:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> xmlns:extra="urn:extra-functions">
> <msxml:script xmlns:msxml="urn:schemas-microsoft-com:xslt"
> language="VBScript" implements-prefix="extra">
> Function DateFormat(InputDate)
> If IsDate(InputDate) Then
> DateFormat = Day(InputDate) & " " &
> Month(InputDate)
> End If
> End Function
> </msxml:script>
>
> <xsl:output method="xml" version="1.0" encoding="UTF-8"
> indent="yes"/>
>
>
>
> <xsl:template name="format-date">
> <xsl:param name="date-to-format" />
>
>
> <xsl:value-of select="extra:DateFormat($date-to-format)" />
> </xsl:template>
>
> </xsl:stylesheet>
>
>
>
> JavaScript version:
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> xmlns:extra="urn:extra-functions">
>
> <msxml:script xmlns:msxml="urn:schemas-microsoft-com:xslt"
> language="JavaScript" implements-prefix="extra">
> function formatDate(dte){
> var dateToFormat = new Date(dte);
>
> return dateToFormat.getDay() + ' ' +
> dateToFormat.getMonth();
> };
> </msxml:script>
>
> <xsl:output method="xml" version="1.0" encoding="UTF-8"
> indent="yes"/>
>
>
>
> <xsl:template name="format-date">
> <xsl:param name="date-to-format" />
>
>
> <xsl:value-of select="extra:formatDate($date-to-format)" />
> </xsl:template>
>
> </xsl:stylesheet>
>
>
> Regards,
>
>
> Kaine
>
>  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.