[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Assigning unique id to new node using generate-id(
Hi Kyle,
At 12:11 PM 8/13/2003, you wrote: I'd like this stylesheet to copy all existing credential nodes and create a new It's a reasonable requirement. with generate-id(). Why? as opposed to by some other means? It appears as if the generate-id The root of your problem is in thinking that generate-id() assigns (unique) IDs to new nodes, when it doesn't; it merely assigns (or retrieves) an ID for a node in the source. The generated value has nothing to do with any value in the source, even if on an attribute called "id". It needs only to be unique to the node provided as argument to the function, or to the context node (in your case, "/profile") if none is given. Given the code you have provided, in which you create only one <credential> and assign it an ID unique to the <profile> you have matched, there is a good chance that the observed duplication is actually faithful to the input, in which IDs are not unique (check to verify whether this is not the case). To guarantee uniqueness, reassign an ID to every credential. Since you are also creating new credentials, a second pass (your current workaround) is an appropriate place to do this. If you have a requirement to preserve IDs where they exist, this is a more complex problem and generate-id() is probably not part of the solution at all. Cheers, Wendell ====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ====================================================================== XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|