aspose file tools*
The moose likes XML and Related Technologies and the fly likes is there a way to generate a time stamp in XSL ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "is there a way to generate a time stamp in XSL ?" Watch "is there a way to generate a time stamp in XSL ?" New topic
Author

is there a way to generate a time stamp in XSL ?

Madhav Lakkapragada
Ranch Hand

Joined: Jun 03, 2000
Posts: 5040
Wondering if I could generate a time stamp of some kind while I transform. Any function that you know...I checked the OOTB functions but seems like there is no easy way...
Any pointers please...
Thanks.
- madhav


Take a Minute, Donate an Hour, Change a Life
http://www.ashanet.org/workanhour/2006/?r=Javaranch_ML&a=81
Mapraputa Is
Leverager of our synergies
Sheriff

Joined: Aug 26, 2000
Posts: 10065
There is no standard function in XSLT 1.0., not sure about XSLT 2.0...
Here is less standard one
http://www.exslt.org/date/functions/time/date.time.function.xsl.html


Uncontrolled vocabularies
"I try my best to make *all* my posts nice, even when I feel upset" -- Philippe Maquet
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
If you're using a java based XLST transformer, there are chances that you can make java calls from your stylesheet.
Have a look at the following URL to see how to do this using Xalan:
Extension function Java calls
You may then use the SimpleDateFormat object to format your timestamp according to your taste.
Write a utility stylesheet (timestamp.xslt):

And call it from your stylesheet like this:

This should do the trick (with Xalan).
Cheers
[ December 16, 2002: Message edited by: Beno�t d'Oncieu ]
Madhav Lakkapragada
Ranch Hand

Joined: Jun 03, 2000
Posts: 5040
So it seems like I can use this to call any java class meassage.
Thanks.
- madhav
Madhav Lakkapragada
Ranch Hand

Joined: Jun 03, 2000
Posts: 5040
Beno�t:
I seems to be missing something.
When I use this example, I get an error
(on the first style sheet) saying
"This file is not valid. Function not found in the namespace."
The select pharase which has the Java:text...new() is highlighted.select="java:util.Date.new(). Although, I have to admit I din't get a chance to read the link you mentioned. While I try that I thought I will let you know and see if you any quick suggestions.......
All I did was copy paste your style sheets and try an example using XML Spy. Maybe I should tyy xalan also...
- madhav
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Madhav,
You have well assumed, this might only work with Xalan. I don't think XML Spy will like that...
Cheers
Madhav Lakkapragada
Ranch Hand

Joined: Jun 03, 2000
Posts: 5040
Timestamp is 20021217114337
Works with xalan.....
- madhav
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: is there a way to generate a time stamp in XSL ?