• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Leverager of our synergies
Posts: 10065
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 5040
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So it seems like I can use this to call any java class meassage.
Thanks.
- madhav
 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 5040
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Timestamp is 20021217114337
Works with xalan.....
- madhav
 
Everybody's invited. Even this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic