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

RE: RE: increment value

Subject: RE: RE: increment value
From: cknell@xxxxxxxxxx
Date: Thu, 22 Jan 2004 12:55:21 -0500
xsl increment value
As has often been said here. You don't (can't) increment a variable. You will have to find another way. Assuming that the root element of your document is named "soup", this will give you the output you asked for.

  <xsl:template match="soup">
    <soup>
    <xsl:apply-templates select="//b" />
    </soup>
  </xsl:template>

  <xsl:template match="b">
    <b>
      <xsl:attribute name="id"><xsl:value-of select="name(.)" /><xsl:value-of select="position()" /></xsl:attribute>
    </b>
  </xsl:template>
-- 
Charles Knell
cknell@xxxxxxxxxx - email



-----Original Message-----
From:     Ricardo Saraiva <rss@xxxxxxxxxxxxxx>
Sent:     Thu, 22 Jan 2004 17:46:56 -0000
To:       <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Subject:  RE:  increment value

Hi,

	That was an example. The numbers were not to be added to the
string.
	Imagine the example without the numbers.

How do I increment a variable to add to the string?

Thanks,

Ricardo Saraiva


-----Original Message-----
From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Andreas L.
Delmelle
Sent: quinta-feira, 22 de Janeiro de 2004 17:16
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE:  increment value

> -----Original Message-----
> From: Ricardo Saraiva
> 
> 
<snip />
> 	<a>
> 	      <b>1</b>
>       	<b>2</b>
>       </a>
> 
>       <a>
> 	      <b>3</b>
>       	<b>4</b>
>       </a>
>       
> The output would be:
>       
> 	<b id="b1"/> 
> 	<b id="b2"/> 
> 	<b id="b3"/> 
> 	<b id="b4"/> 
> 	.
>

Something like:

<xsl:template match="a/b">
  <xsl:element name="b">
    <xsl:attribute name="id">
      <xsl:value-of select="concat(name(.),.)" />
    </xsl:attribute>
  </xsl:element>
</xsl:template>

Cheers,

Andreas


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list





 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list




 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.