OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Re: [docbook-apps] Date and Time normalization


Hi Richard,
EXSLT does have some date-time functions, including one that will generate the current date and time in a standard format.  Perhaps the most useful function for you will be date-format() to convert a standard date string into some other output format. 
 
But EXSLT does not include a function to parse an arbitrary string into a standard date string.  That is actual a hard problem with ambiguities that must be resolved, such as "Is 3/12/2012 to be interpreted as March 12 or December 3?".  And month names and abbreviations come in many languages and abbreviation styles.  I have not been able to find an XSLT module that can handle such conversions.  If you find something, please let me know and I will add it to the DocBook epub3 stylesheet.
 
The standard xs:date string format is CCYY-MM-DD.  If you can get your data into that format, then the EXSLT date functions can process it.
 
Bob Stayton
Sagehill Enterprises
bobs@sagehill.net

Sent: Monday, December 03, 2012 10:52 AM
Subject: [docbook-apps] Date and Time normalization

 

I want to "normalize" some dates in my DocBook.

Ie I have dates written in a number of different formats (eg 3/12/2012, 3 Dec 2012, 3 December 2012) which I'd like to normalize into one. 

This is sometimes just to achieve consistency in the output documents - ie to make them the same as my existing ones, written in Word, despite their starting out in a number of different formats.  Though in one particular case, epub3, it is to get the dates into the format required by the spec.  Epub requires dates in a particular format, and the existing eupb3 stylesheets just pass dates through as found in the source (and I have known it to leave duplicates, though I may have tweaked one of my source files to fix this as it isn't happening with my test file right now).

 

I'm expecting to do this by using a standard function to parse the dates as strings, then to use a formatting function to get the resultant date/time into a chosen format.

I can't see an XSLT 1 function to do this but I think there's one in EXSLT.

Can anyone advise on the best option to use.  Or direct me to any other options available.

 

 

Regards,

Richard.

 

 

 

 

 

 

Richard Kerry

BNCS Engineer

T: +44 (0)20 82259063

M: +44 (0)7812 325518

Room EBX 301, BBC Television Centre, Wood Lane, London, W12 7RJ

richard.kerry@atos.net

uk.atos.net

This e-mail and the documents attached are confidential and intended solely for the addressee; it may also be privileged. If you receive this e-mail in error, please notify the sender immediately and destroy it. As its integrity cannot be secured on the Internet, the Atos group liability cannot be triggered for the message content. Although the sender endeavours to maintain a computer virus-free network, the sender does not warrant that this transmission is virus-free and will not be liable for any damages resulting from any virus transmitted.



---------------------------------------------------------------------
To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]