|
Subject: RE: [xsl] Indexing in xsl From: "Andrew Welch" <awelch@xxxxxxxxxxxxxxx> Date: Thu, 21 Feb 2002 13:58:27 -0000 |
><orders order1-id="1" order2-id="2" order2-id="3" order2-id="4" />
Well, if you meant:
<orders order1-id="1" order2-id="2" order3-id="3" order4-id="4" />
Then you could use:
<xsl:template match="orders">
<xsl:copy>
<xsl:for-each select="order">
<xsl:attribute name="{concat(local-name(), position(), '-','id')}">
<xsl:value-of select="@id"/>
</xsl:attribute>
</xsl:for-each>
</xsl:copy>
</xsl:template>
You were nearly right, you just needed to use position() instead of a var to
get the incrementing value.
cheers
andrew
===
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.325 / Virus Database: 182 - Release Date: 2/19/02
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] Indexing in xsl, David Carlisle | Thread | [xsl] embedded <xsl-for-each>, Sébastien Tisserant |
| Re: [xsl] Indexing in xsl, David Carlisle | Date | RE: [xsl] embedded <xsl-for-each>, Andrew Welch |
| Month |