|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Problem with generating sequence ids.
Hi,
> I want the xslt code to get the result as
> <A1 sequence="1" id="001000000000000">
> <B1 sequence="3" id="001003000000000"/>
> <B2 sequence="1" id="001001000000000">
> <C1 sequence="4" id="001001004000000"></C1>
> <C2 sequence="11" id="001001011000000">
> <D1 sequence="01" id="001001011001000"/>
> </C2>
> </B2>
> </A1>
>
> Steps to generate id value :
[snip]
Unfortenately I didn't have time to read you explanation how the IDs should be
generated, I only compared the input and desired output. Hope it's what you
need.
<xsl:template match="*">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:attribute name="id">
<xsl:for-each select="(ancestor-or-self::*)">
<xsl:number value="@sequence" format="001"/>
</xsl:for-each>
<xsl:value-of select="substring('00000000000000',
count(ancestor-or-self::*) * 3)"/>
</xsl:attribute>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
Cheers,
Jarno
--
Nu Energy Collective: Logic dec 2004
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








