I am processing an XML file where I want to keep count of the number of nodes, so that I can use it as an ID as I write new nodes.
At the moment I have a global vari
Haven't tried this myself, but you could try and pass a parameter to the template. In your first template you set the parameter to count() (or current() maybe?) within the for-each statement and then pass that value to your "section" template.
Here's more on passing parameters to templates