Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 11th, 2006, 01:01 AM
Registered User
 
Join Date: Sep 2006
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default Plz help: looping variable in xsl

<xsl:for-each select="Y/Z">
<input>
<xsl:attribute name="name">remark</xsl:attribute>
<xsl:attribute name="class">specialchar</xsl:attribute>
<xsl:attribute name="Value"><xsl:value-of select="I"/>
</xsl:attribute>
</input>
</xsl:for-each>

here i wanted to use iterator like

<xsl:for-each select="Y/Z">
int i=1;
<input>
<xsl:attribute name="name">remark[i]</xsl:attribute>
<xsl:attribute name="class">specialchar</xsl:attribute>
<xsl:attribute name="Value"><xsl:value-of select="I"/>
</xsl:attribute>
</input>
i++;
</xsl:for-each>

As i am new to xslt, i am not able to do it..
Plz help


 
Old September 11th, 2006, 05:38 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Use the position() function, which gives you values 1..n for each item processed by the for-each instruction

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to response.write a looping variable ? tiahvera Classic ASP Basics 6 June 20th, 2007 09:24 PM
ASSIGNING A JAVA SCRIPT VARIABLE TO A XSL VARIABLE SOMANATHAN10 XSLT 1 February 21st, 2007 04:26 AM
xsl:variable holding name of an xsl:param perissos XSLT 0 December 5th, 2006 07:09 AM
The difference between xsl:variable and xsl:param NEO1976 XML 2 July 24th, 2006 06:05 AM
pass java variable to xsl variable kathy1016cats XSLT 1 June 14th, 2006 06:23 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.