This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Indexing in xsl



><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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]