[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] Re: date format using xslt 1.0


Subject: [xsl] Re: date format using xslt 1.0
From: Jacob L <arkle.ash@xxxxxxxxx>
Date: Fri, 15 Jun 2012 13:09:18 -0400

Hi,

I am using this xslt shared by Mr.David.Can anyone help me with the
code to convert the time also.I previously sent message that it is not
important,but now the req. has changed.Thanks.

<xsl:stylesheet version="1.0"
               xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="date">
<xsl:variable name="a" select="substring-after(.,', ')"/>
<xsl:variable name="d" select="substring-before($a,' ')"/>
<xsl:variable name="b" select="substring-after($a,' ')"/>
<xsl:value-of select="concat(
substring-before(substring-after($b,' '),' '),
format-number(string-length(substring-before('xxxJanFebMarAprMayJunJulAugSepOctNovDec',substring-before($b,'
'))) div 3,'00'),
format-number($d,'00')
)"/>
</xsl:template>
</xsl:stylesheet>

On Tue, Jun 12, 2012 at 1:47 PM, Jacob L <arkle.ash@xxxxxxxxx> wrote:
> Hi,
>
>
> I am trying to write an XSLT for formatting date.I am unable to find
> any such previous posting,so sending it to the list.Here is my
> requirement.
>
> Input format:
>
> <date>Mon, 11 Jun 2012 17:29:42 +0000 </date>
>
> After the transform,I want output as:-
>
> <date>20120611</date> which is YYYYMMDDkkmmss
>
> Time at the end is not important.I am using XSLT 1.0 and SAX parser.
>
> Thanks a lot!


Current Thread
Keywords