473,376 Members | 1,029 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,376 software developers and data experts.

Insert current timestamp/date from XSLT stylesheet into a XML document ???

I am performing a XSLT stylesheet on a XML document and produce a new XML document.
How can I insert in this new XML stylesheet a tag

<currtime>..."the current date/time"....</currtime>

where "the current date/time" above is replaced by the real current time (e.g.
12th Sep 2004 09:23:78

Michael

Jul 20 '05 #1
3 38711
Am Mon, 04 Oct 2004 07:41:38 +0200 schrieb Michael Hertz:
<currtime>..."the current date/time"....</currtime>


With xsltproc I use:
--stringparam date="`date stylesheet.xsl`"

Then you have to a xsl:param where the value is the momentary date

Thomas
Jul 20 '05 #2
Its possible with extension functions..

Please try this..
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:datetime="http://exslt.org/dates-and-times"
exclude-result-prefixes="datetime">

<xsl:template match="/">
<currtime>
<xsl:value-of select="datetime:dateTime()" />
</currtime>
</xsl:template>

</xsl:stylesheet>

(Tested with Xalan-J 2.6.0)

Regards,
Mukul

mh****@yahoo.com (Michael Hertz) wrote in message news:<cj*************@news.t-online.com>...
I am performing a XSLT stylesheet on a XML document and produce a new XML document.
How can I insert in this new XML stylesheet a tag

<currtime>..."the current date/time"....</currtime>

where "the current date/time" above is replaced by the real current time (e.g.
12th Sep 2004 09:23:78

Michael

Jul 20 '05 #3


Michael Hertz wrote:
I am performing a XSLT stylesheet on a XML document and produce a new XML document.
How can I insert in this new XML stylesheet a tag

<currtime>..."the current date/time"....</currtime>

where "the current date/time" above is replaced by the real current time (e.g.
12th Sep 2004 09:23:78


With XSLT 1.0/XPath 1.0 you need to define a global parameter e.g.
<xsl:param name="now" />
and then use processor specific means to set that parameter before you
run the transformation.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Thomas Mann | last post by:
Hi, how can I make my XSLT-stylesheet insert a timestamp (date/time) into the output file ? Regards Thomas
7
by: pintihar | last post by:
Hi, As a follow on from an earlier post I have another question about xslt. Is it possible to create the stylsheet programatically? Is this sensible? In the first phase I needed to map element...
2
by: Richard L Rosenheim | last post by:
I loaded a XSLT stylesheet into a XMLDocument to retrieve some of the data. I received an exception when the SelectNodes method was invoked. The message was "System.Xml.XPath.XPathException -...
4
by: dar_imiro | last post by:
Hi, I'm trying to get rid of frames as menu holder in my html-page. I'd also like to separate the menu structure to xml and xslt. Also the actual content is divided to xml and its corresponding...
16
by: Brian Tkatch | last post by:
I have a PROCEDURE that test other PROCEDUREs. Timings_Call ------------------ Id Group Name Text Timings_Log
4
by: th1421 | last post by:
Hi, I'm new to FireFox. I am currently trying to convert my website to be compatible with it. Doing so Iím trying to process some XML/XSLT pages (preferably without using JavaScript). When I...
0
by: gpspocket | last post by:
help me -CURSOR backward insert from End Date > to Start Date how to insert dates from end to start like this SELECT 111111,1,CONVERT(DATETIME, '17/03/2008', 103), CONVERT(DATETIME,...
7
by: Damir | last post by:
I have a situation on a DB server where the "current timestamp" command shows the actual system time offset by one hour, which has never been noticed before?!? The DB2 is V9.1 (FP03), running on...
1
by: somadritadas23 | last post by:
I have a variable declaration inside a procedure which is not compiling in db2 9.5 :- DECLARE VSTARTTIME TIMESTAMP DEFAULT CURRENT TIMESTAMP; The procedure is a test procedure :- DROP...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.