i have created a simple XSLT file which does XML-to-XML transformation.
- i want to declare a counter which will be used to assign sr. number to every record in 001, 002, 003... format. How can i declare such counter with 00[0-9] format?
- i want to remove leading 0s from one of the int field. like 003045 should be converted to 3045.
Advice: stop thinking about procedural languages when you're coding XSLT. It's just going to confuse you and lead you into trying things which can't be done. It's a waste of time.
For example in this case you're thinking about "i++" which can't be done in functional languages and that is preventing you from getting to the position() function, which is what you actually want. Get yourself some tutorials and books about XSLT, read examples until you can detox yourself from this procedural obsession.
Joined: Sep 14, 2009
That's right Paul.
I am a Java/J2EE developer and it is difficult for me to think in Functional Language style in initial learning .
I have found out the usage of position() function to find the counts using below code.