Tempore 15:15:09, die 07/06/2005 AD, hinc in
xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com scripsit Lakshmi narayana
<lchintala(_at_)osi-tech(_dot_)com>:
I am facing the problem to create the IDs to the elements. See the
following example XML file.
While all replies currently raining down are correct, I thought I might
provide a stylesheet that actually follows the algorithm you wrote:
<xsl:template match="node()|@*">
<xsl:param name="parentid"/>
<xsl:variable name="myid"
select="concat($parentid,format-number((ancestor-or-self::*/@sequence)[last()],'000'))"/>
<xsl:copy>
<xsl:attribute name="id">
<xsl:value-of
select="substring(concat($myid,'0000000000000000'),1,15)"/>
</xsl:attribute>
<xsl:apply-templates select="node()|@*">
<xsl:with-param name="parentid" select="$myid"/>
</xsl:apply-templates>
</xsl:copy>
</xsl:template>
--
Joris Gillis (http://users.telenet.be/root-jg/me.html)
Spread the wiki (http://www.wikipedia.org)
--~------------------------------------------------------------------
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>
--~--