xsl-list
[Top] [All Lists]

[xsl] Re: date format using xslt 1.0

2012-06-15 12:09:35
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(_dot_)ash(_at_)gmail(_dot_)com> 
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!

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>