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

RE: Indexing in xsl

Subject: RE: Indexing in xsl
From: "Andrew Welch" <awelch@xxxxxxxxxxxxxxx>
Date: Thu, 21 Feb 2002 13:58:27 -0000
xsl indexing
><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

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.