Page 1 of 1

Set current date as transformation scenario parameter

Posted: Sat Jan 10, 2009 7:18 pm
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.

Re: Set current date as transformation scenario parameter

Posted: Mon Jan 12, 2009 12:09 pm
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