Hi Karlheinz,
I couldn't test your stylesheet because of the missing pieces (imported stylesheet, source XML), but once I made some modifications to it I verified that the saxon:assign is updating the counter. I am using Stylus Studio 2008 build 1050g; which version are you using?
Hi Karlheinz,
thank you for providing the complete stylesheet; we can reproduce the problem (if you place a breakpoint in the daxtor:lPad function you can see that the global variable $counter is correct, but $value is always 0).
It looks that the bug is in the schema-based optimizer of Saxon; if you go to the scenario dialog, in the processor tab, and click Settings, you can work around the problem by selecting the Basic execution mode.