[Home] [By Thread] [By Date] [Recent Entries]
Tempore 15:15:09, die 07/06/2005 AD, hinc in
xsl-list@xxxxxxxxxxxxxxxxxxxxxx scripsit Lakshmi narayana
<lchintala@xxxxxxxxxxxx>:
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)
|

Cart



