Re: [xsl] Incrementing number in a for loop ??

Subject: Re: [xsl] Incrementing number in a for loop ??
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Wed, 30 Jul 2003 21:27:18 -0400
At 2003-07-30 19:56 -0400, Dipesh Khakhkhar wrote:
I am creating a text output from xml and at some places i have to give
hardcoded special characters.

This not a very explicit description of a problem that needs to be solved using incrementing variables.


Is is possible to declare a variable having numerical value and incrementing
it using expression inside for loop ?

No ... this is a FFFFAQ ... even a simple query will tell you the answer to this question:


http://www.google.com/search?as_q=increment+global+variable+xslt

Gee, it even happens to be my answer that is at the top of the list tonight.

If somebody can throw some light on this issue i would be grateful.

Variables in XSLT do not vary within their scope. Now your question has been answered, but you only asked a yes/no question and you haven't given enough detail for anyone to help you with your real problem.


If you take a moment to describe the nature of the problem you are trying to solve where you think you need a varying variable, people on the list will be able to tell you about the position() function or the <xsl:number/> instruction, or about tree walking with recursive template calls, or any of a number of other XSLT facilities that may be able to help you solve your problem.

And please take your time to try and do *some* research before asking people to take from their time to answer your questions that have already been answered.

I hope this helps.

............... Ken


-- Upcoming hands-on courses: in-house corporate training available; North America public: XSL-FO Aug 4,2003; XSLT/XPath Aug 12, 2003

G. Ken Holman                mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Crane Softwrights Ltd.         http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0   +1(613)489-0999 (F:-0995)
ISBN 0-13-065196-6                      Definitive XSLT and XPath
ISBN 0-13-140374-5                              Definitive XSL-FO
ISBN 1-894049-08-X  Practical Transformation Using XSLT and XPath
ISBN 1-894049-11-X              Practical Formatting Using XSL-FO
Member of the XML Guild of Practitioners:    http://XMLGuild.info
Male Breast Cancer Awareness http://www.CraneSoftwrights.com/s/bc


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



Current Thread