Subject:Adding a number to a for each loop Author:Mark Berry Date:24 Feb 2008 05:45 PM
Hi this is my first post to the forum. I guess I am asking a question that has been asked many times before. However, I am new to xsl and programming so I am looking for a nice simple answer that I can implement in my code.
In my code I have a for-each loop that extracts information for posting onto an electronic map. Each item posted to the map needs a unique identifier and this is not available in the xml that is being transformed. Therefore I need something that counts each time I execute the for-each loop so I can use it as an identifier for the item.
The loop contains 2 different types of item so I cannot use the node number as the unique identifier. For example I have a total of 6 items of 2 different types mixed up so I want A1, A2, A3, B1, B2, B3 if I use the node number I end up with A1,A2,B3,B4,A5,B6.
That may be too much detail but all I really need is some code that numbers the for-each loop each time it is executed.
Any help great fully accepted (this has been driving me nuts!)