|
Subject: RE: [xsl] Problem with generating sequence ids. From: <Jarno.Elovirta@xxxxxxxxx> Date: Wed, 6 Jul 2005 16:09:27 +0300 |
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
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| RE: [xsl] Refering the processed no, Michael Kay | Thread | [xsl] Problem with generating seque, Lakshmi narayana |
| Re: [xsl] Problem with generating s, David Carlisle | Date | RE: [xsl] Problem with generating s, Michael Kay |
| Month |