xsl-list
[Top] [All Lists]

RE: [xsl] Date YYYYMMDD format XSLT 2.0

2008-09-16 06:01:09
 
Michael wrote
==============


There are no built-in functions for parsing dates in non-standard formats
(as distinct from formatting them), but you can do it easily enough using
regular expressions and xsl:analyze-string.

The precise solution depends on a precise definition of your input format,
which you haven't given us.

=====

Well Michael this is a new project I am working on with very fewer samples.
Though I have cross checked that date will not be available in the input
@version attribute so the default 01 will work. So the inputs will be as
shown below (three character Month followed by ". " and four digit year):

<chapter version="Feb. 2000"/> 
<chapter version="Oct. 2006">

And should be outputted as <chapter version="20000201"/> and <chapter
version="20001001"/>

Apart from this I need to ignore attributes values with "Update" (<chapter
version="Dec. 2003 Update">) which I will be able to handle with string
check (contains() function)

Thanks in advance for any suggestions.

Pankaj




 

-----Original Message-----
From: Pankaj Chaturvedi [mailto:pankaj(_dot_)chaturvedi(_at_)idsil(_dot_)com]
Sent: 16 September 2008 09:49
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Date YYYYMMDD format XSLT 2.0


Hi,

I have an element which has the date in the below format in an 
attribute:

Input
================
<chapter version="Feb. 2000"/>

The date could be optional can be taken as 01 by default. So the 
desired output required in "YYYYMMDD format".

Output Required
================
<chapter version="20000201"/>


I've been going thru the Michael Kay's book and found it has an 
example which does the trick vice versa. I mean YYYYMMDD to 01 Feb 
2000 for instance.

I am using the  XSLT 2.0 and thinking of using translate() functions 
(for
months) to get this done. Is there any better way to achieve this? Any 
suggestions will be highly appreciated.

Best,

Pankaj Chaturvedi

==============================================================
==============
================


Confidentiality Notice:" This message and any attachment(s) contained 
here are information that is confidential, proprietary to IDS Infotech 
Ltd. and its customers.
Contents may be privileged or otherwise protected by law. The 
information is solely intended for the individual or the entity it is 
addressed to. If you are not the intended recipient of this message, 
you are not authorized to read, forward, print, retain, copy or 
disseminate this message or any part of it. If you have received this 
e-mail in error, please notify the sender immediately by return e-mail 
and delete it from your computer."

--~------------------------------------------------------------------
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>
--~--



--~------------------------------------------------------------------
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>
--~--



--~------------------------------------------------------------------
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>
--~--