Yes it's possible. The i18nTransformer [1] uses SimpleDateFormat [2]. So 
converting from yyyyMMddHHmmss into e.g. EEEE d MMMM yyyy HH:mm is no problem. 
The input format must match the exact pattern of the input value.

[1] http://cocoon.apache.org/2.1/userdocs/i18nTransformer.html
[2] http://java.sun.com/j2se/1.4.2/docs/api/java/text/SimpleDateFormat.html

Jasha


-----Oorspronkelijk bericht-----
Van: [EMAIL PROTECTED] namens Marco Casavecchia Morganti
Verzonden: di 29-7-2008 19:15
Aan: Hippo CMS development public mailinglist
Onderwerp: Re: [HippoCMS-dev] Publication Date
 
Humm..
I tryed your suggestion but it doesn't work for me :O(

I have the "getpublicationdate" filed that has something like this: 
"1217340166960" and i would like to have it changed into the following 
format: "yyyyMMddHHmmss".

Do you think it is possible?

Thanks again.

Ard Schrijvers wrote:
> Yesssss,
> 
> You can use for example 
> 
> <i18n:date-time pattern="short" src-pattern="EEE, d MMM yyyy H:mm:ss z"
> src-locale="en_UK" locale="nl_NL">
>     <xsl:value-of
> select="$response/D:propstat/D:prop/D:getlastmodified"/>
> </i18n:date-time>
> 
> Or
> 
> <i18n:date-time pattern="EEEEE d MMMMM yyyy H:mm:ss 'uur'"
> src-pattern="EEE, d MMM yyyy H:mm:ss z" src-locale="en_UK"
> locale="nl_NL">
>    <xsl:value-of
> select="$response/D:propstat/D:prop/D:getlastmodified"/>
> </i18n:date-time>
> 
> And do an i18n transformer after the xsl. Make sure you do a simple test
> first on for example the string-length of the date field before adding
> the <i18n:date-time element>, because you'll get an i18n exception when
> the conversion does not succeed.
> 
> So wrap the above with:
> 
> <xsl:if test="string-length(h:publicationdate) = someInt">
> 
> Then i18n:date-time element,
> 
> Regards Ard
> 
> 
> 
>> Hello all,
>>
>> Is there an "xsl way" to convert the "h:publicationdate" 
>> property of a document?
>>
>> I'm working into hippo-cocoon to render a simple html page 
>> and i need an xsl:template that converts the value of that 
>> field into something human readable.
>>
>> Thanks in advance.
>> --
>> By MCM.
>> ********************************************
>> Hippocms-dev: Hippo CMS development public mailinglist
>>
>> Searchable archives can be found at:
>> MarkMail: http://hippocms-dev.markmail.org
>> Nabble: http://www.nabble.com/Hippo-CMS-f26633.html
>>
>>
> ********************************************
> Hippocms-dev: Hippo CMS development public mailinglist
> 
> Searchable archives can be found at:
> MarkMail: http://hippocms-dev.markmail.org
> Nabble: http://www.nabble.com/Hippo-CMS-f26633.html
> 
> 


-- 
By MCM.

<< La teoria è quando si sa tutto ma non funziona niente.
La pratica è quando tutto funziona ma non si sa il perché.
In ogni caso si finisce con il coniugare la teoria con la pratica: non 
funziona niente e non si sa il perché. >>
(A. Einstein)
********************************************
Hippocms-dev: Hippo CMS development public mailinglist

Searchable archives can be found at:
MarkMail: http://hippocms-dev.markmail.org
Nabble: http://www.nabble.com/Hippo-CMS-f26633.html


<<winmail.dat>>

********************************************
Hippocms-dev: Hippo CMS development public mailinglist

Searchable archives can be found at:
MarkMail: http://hippocms-dev.markmail.org
Nabble: http://www.nabble.com/Hippo-CMS-f26633.html

Reply via email to