Re: [xsl] Problem with using xsl:variable within a template in XSL1.0

Subject: Re: [xsl] Problem with using xsl:variable within a template in XSL1.0
From: Abel Braaksma <>
Date: Fri, 14 Dec 2007 09:36:47 +0100
Gareth Howells wrote:
The problem was down to the code that was in the for-each loop accessing a variable which wasn't visible to the template that replaced the loop.

This is a compile time error and may be the cause of your stack trace, but it is much easier to first debug the components (unit testing) before you put the components into a larger system (Tomcat) as it will get much harder to find out who caused the error.

I'd like to repeat my previous question again, which I asked twice on your previous thread: what processor are you using, (maybe I missed the answer, if so, my apologies). Because it is quite odd that your processor allows for xsl:key outside the root level and variables outside their scope....

If you want to know how you can debug your XSLT stylesheet out of the Tomcat system we can help you out once you know the processor.

As a side note, we've been getting some rather interesting stack traces today though - 84 students on the module, all trying to test their solutions before submitting, on a dedicated Debian server running Tomcat and basically nothing else, with 16GB of RAM. And we got out of memory errors ;)

That is not so strange. Depending on how you start the Tomcat server, depending on how you configured your processor (see above), depending on your source XML, depending on external resources and depending on the way you constructed the XSLT this can have a very logical solution. It is possible to get out of memory errors with a couple of lines of code of XSLT, regardless the size of the input (as it also takes only one statement in Java/C++/VB/PHP etc to get out-of-mem errors). To find out, do the following:

1. run the stylesheet outside Tomcat
2. if still an out-of-mem error, run it with a different processor
3. if still an out-of-mem error, show us the stylesheet and the input and the processor and the commandline

It is possible, of course, to change the mem size with the -X modifiers. Your 16GB of RAM will not be addressed or used unless you tell the JVM how much is may use. But I doubt if that will stop your out-of-mem errors.

-- Abel Braaksma

Current Thread