I wouldn't have expected limitations on the number of nodes to cause a _stack_ overflow, unless we're failing to detect wrap-around and thus going into an endless recursion.
I pesume you've tried simply increasing the JVM's stack-size limits. Deep recursion _could_ be legitimate, depending on your document and stylesheet.
