https://community.cisco.com/t5/nso-developer-hub-discussions/xpath-position/td-p/3513828
For context please first review the issue described in the link above. We left this issue at a point where it was determined that moving to 4.6+ was the only possible solution which supports new capabilities in the template such as setting variable values and several new loop constructs. I have upgraded one of our lab nodes to 4.6.1.3, and where I am still stuck is - within the foreach loop segment - how to increment the value of the counter. In the 4.6.1.3 development guide, the section on pg.261, only demonstrates the ability to increment a counter when using a for loop construct, but does not show any indication of how this may done in a foreach context, where the value of the counter is preserved across each pass, incremented and subsequently applied in the template.