xsl-list
[Top] [All Lists]

RE: Generating Unique ID

2005-12-08 05:14:03

Thank you all for the help provided on generating the unique ID.

Best Regards.

Arun



From: "Ragulf Pickaxe" <ragulf(_dot_)pickaxe(_at_)hotmail(_dot_)com>
Reply-To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: [xsl] Generating Unique ID
Date: Tue, 06 Dec 2005 09:35:23 +0100

Hi Arun,

Why do you need the id to contain its parents id as well?

You have a function, generate-id(), which generates a unique id on a node.

If you need an id like what you state, you will need to do something like this (a variation of identity template):

<xsl:template match="*">
 <xsl:variable name="special-id">
   <xsl:for-each select="ancestor-or-self::*">
     <xsl:value-of select="generate-id(.)"/>
   </xsl:for-each>
 </xsl:variable>
 <xsl:copy>
   <xsl:copy-of select="@*"/>
<xsl:attribute name="ID"><xsl:value-of select="$special-id"/></xsl:attribute>
   <xsl:apply-templates/>
 </xsl:copy>
</xsl:template>

Is the above what you need?

Regards,
Ragulf Pickaxe :-)

_________________________________________________________________
Find det, du søger på MSN Søg http://search.msn.dk


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--




--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>