Subject: Re: [xsl] Assigning unique id to new node using generate-id() From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Date: Wed, 13 Aug 2003 15:02:28 -0400 |
I hope this helps, Wendell
Thank you for you reply.
I would like to keep the existing ID's the same. As they are referenced from other nodes (a credential is referenced from 0 or more services).
My current workaround seems to be working although I'm not 100% convinced that it
will always create a unique id.
After new node is created without an id, I transform the document again with. This is run against the result of the first transform which adds the new credential without and id.
<xsl:for-each select="credential">
<xsl:choose>
<xsl:when test="@id">
<xsl:copy-of select="."/>
</xsl:when>
<xsl:otherwise>
<credential>
<xsl:attribute name="id">
<xsl:value-of select="generate-id()"/>
</xsl:attribute>
<xsl:copy-of select="username"/>
<xsl:copy-of select="password"/>
<xsl:copy-of select="description"/>
<xsl:copy-of select="lastModified"/>
</credential>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
As I said, this seems to work.
What other methods would you recommend for generating a unique id? It is possible, albeit unlikely, that the a profile may contain identical credential nodes (where username, password, description and lastModified are identical).
Thanks, Kyle
====================================================================== 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 ======================================================================
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Assigning unique id to ne, kyle.himmerick | Thread | RE: [xsl] Assigning unique id to ne, Michael Kay |
Re: [xsl] document function, J.Pietschmann | Date | Re: [xsl] How to "copy" a DTD refer, Mark R. Diggory |
Month |