[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Problem with generating sequence ids.

Subject: Re: Problem with generating sequence ids.
From: "Joris Gillis" <roac@xxxxxxxxxx>
Date: Wed, 06 Jul 2005 15:25:05 +0200
Re:  Problem with generating sequence ids.
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)

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.