View Single Post
  #2 (permalink)  
Old May 6th, 2008, 01:48 PM
iceandrews iceandrews is offline
Authorized User
Points: 340, Level: 6
Points: 340, Level: 6 Points: 340, Level: 6 Points: 340, Level: 6
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2008
Location: , OH, USA.
Posts: 70
Thanks: 17
Thanked 1 Time in 1 Post
Send a message via Yahoo to iceandrews
Default

It is my understanding that you can make use of the XPath function 'current-dateTime()' to retrieve the system time.

This would provide you with the current system time in the xs:dateTime type.

You could then make use of the format-dateTime() function to restructure the time in the format that you require. You can basically customize the way you want to output the current time.

A very simple style sheet with no input document.

Code:
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" />

<xsl:template match="/">
<html>
<body>
<xsl:value-of select="format-dateTime(current-dateTime(), '[Y,4][D,2][M,2] [H]:[m]:[s] [Z]')" />
</body>
</html>        
</xsl:template>

</xsl:stylesheet>
This stylesheet will output the following:
Code:
<html>
  <body>20080605 14:45:04 -04:00</body>
</html>
Good luck!
Reply With Quote