I am trying to increment COUNTER variable by 1 inside a for-each loop of BIP report using below code.
However, COUNTER variable are not incremented not matter how many loop there is. Can someone please guide me how to do this.
Also I am aware of position()
function but it does not suffice my needs.
<?xdoxsllt:set_variable($_XDOCTX, 'COUNTER', 1)?>
<?for-each@section:SECTION1?>
<?xdoxslt:set_variable($_XDOCTX, 'COUNTER', xdoxslt:get_variable($_XDOCTX, 'COUNTER') + 1?>
<?end for-each?>
<?xdoxslt:get_variable($_XDOCTX, 'COUNTER')?>
You were Missing two things: 1. 'xdoxslt' in the first line was written as 'xdoxsllt' 2. A closing braces after 1 in line no.3
<?xdoxslt:set_variable($_XDOCTX, 'COUNTER', 1)?>
<?for-each@section:SECTION1?>
<?xdoxslt:set_variable($_XDOCTX, 'COUNTER', xdoxslt:get_variable($_XDOCTX, 'COUNTER') + 1)?>
<?end for-each?>
<?xdoxslt:get_variable($_XDOCTX, 'COUNTER')?>