[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: generate-id()

Subject: Re: generate-id()
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Tue, 13 Nov 2001 23:09:30 +0000
dhtml generate a unique id
Hi David,

> I have an issue w. generating a unique id from a called template in
> an included XSL file. I use the template to create buttons for the
> bottom of a form. Their content is not based on the XML, but values
> such as Save, Delete, etc. The DHTML code that's I'm using requires
> each button the have a unique name.

If the buttons that you're generating aren't based on the source XML,
then you must know what buttons are being generated in advance, such
that you can hard code as unique values within the XSLT document
itself.

  <button name="save" value="Save" />
  <button name="delete" value="Delete" />
  ...

If they *do* depend on something about the source XML, so effectively
you want several IDs from the same node, then you can get the ID of
the current node at the point where you call the template:

  <xsl:variable name="id" select="generate-id()" />

and then couple that with the unique name for the buttons:

  <button name="save{$id}" value="Save" />
  <button name="delete{$id}" value="Delete" />
  ...

(I personally use a matching, moded template rather than a named
template when my code depends on a property (such as the identity) of
the current node, but that's just a matter of preference.)

If this isn't what you're after, do send a snippet of the XSLT that
you have so we can get a better grasp on what you're aiming for.

Cheers,

Jeni

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


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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.