Variable Declaration in XML Template
I want to get the total page count in a report. The word field { NUMPAGES } gives the value but this value cannot be used in any of the calculations neither its value can be assigned to a variable.
We have declared a variable in the header template and are incrementing it for each header display with the following syntax.
<?xdoxslt:set_variable($_XDOCTX, 'pagecount',xdoxslt:get_variable($_XDOCTX, 'pagecount')+1)?>
However to get this working properly 'pagecount' should be initialized to 0 before this with the following syntax.
<?xdoxslt:set_variable($_XDOCTX, 'pagecount',0)?>
If we declare this in the header each time the header is displayed this variable resets to '0' and the pagecount increments only to 1.