Re: [xsl] generating unique Id and System date in XSL

Subject: Re: [xsl] generating unique Id and System date in XSL
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Thu, 10 Jul 2003 09:42:18 +0100
Hi Anil,

> I need to generate a unique id(based on date preferably..is there a
> better way to generate the unique id?) in XSL to show in a HTML
> form, also i need to show the date in another column in some
> format....any inputs/ideas abt how i can do this?

There's no way of getting hold of the current date from within basic
XSLT 1.0, unless you count passing it in as a parameter. Some
processors have extension functions that allow you to access the
current date, such as date:dateTime() from EXSLT; you should check
your processor's documentation to see if it has such.

But as far as generating a unique ID goes, you should use the
generate-id() function. It takes a node as an argument and generates a
unique identifier for that node, so as long as you call it with
different nodes each time, you'll get a different unique ID each time.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread