Hi Christian, To support debugging my code I'm writing a module with debugging-functions in xquery. To reduce the impact of the debug-functions on my code I want this debug-module to be statefull. So every time a debug-function is called it remembers it's previous debug state. This way I don't have to carry this debug state all throughout my already complex code. I've tried several options but without success. My latest attempt uses file-read and -write( see attached file), but I don't understand how these functions behave. Can you give me a hint how to approach this? Thanx in advance, Rob Stapper PS. This debug-state could look something like: <debugState functionName 'child-child-function-name' level='3'> <debugState functionName 'child-function-name' level='2'> <debugState functionName 'parent-function-name' level='1'/> </ debugState> </ debugState> --- Dit e-mailbericht is gecontroleerd op virussen met Avast antivirussoftware. http://www.avast.com