Set current date as transformation scenario parameter

Are you missing a feature? Request its implementation here.
mrlucmorin
Posts: 1
Joined: Sat Jan 10, 2009 7:14 pm

Set current date as transformation scenario parameter

Post by mrlucmorin »

Hi,

I don't know if what I'm looking for is already there, I tried to find it but couldn't.

I have some transform style sheets that expect a date parameter, and I'd like to have a variable, just like the ones available right now, like ${cfd} for the current file directory, but for the current date.

This way the current date would always be passed to the template and I wouldn't have to manually enter it each time.

Thank you.
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: Set current date as transformation scenario parameter

Post by sorin_ristache »

Hello,

You can just use the XSLT 2.0 functions current-date() and current-dateTime(). If you have to use XSLT 1.0 you can call the Java class java.util.Date in a Java extension of your XSLT 1.0 stylesheet. Both the XSLT 2.0 functions and the class java.util.Date called as Java extension return the current date / date and time at the moment of XSLT processing.


Regards,
Sorin
Post Reply