I've put a diagnostic patch into Subversion to print out relevant data structures when this occurs, and this will be in the build when I get that out.
I've done some careful desk-checking of the code and (a) I can't find anything wrong, and (b) there aren't even any suspicious circumstances, like use of shared memory areas or the NamePool. I'm increasingly suspecting a JVM bug. I know that sounds like desperation but they do happen.
To give some background, Saxon is compiling a literal result element, and searches the tree representation of the stylesheet to find all in-scope namespaces, each of which is represented by an integer code. It puts these codes in a data structure called IntHashSet, and then later reads the values out into an array of integers. The size of the array is initialized to intHashSet.size(), and the codes are then extracted using an iterator. The iterator appears to return more codes than the size of the array.
Michael Kay

From: Michael Kay [mailto:mike@saxonica.com]
Sent: 13 March 2009 00:13
To: 'Mailing list for the SAXON XSLT and XQuery processor'
Subject: Re: [saxon] ArrayIndexOutOfBoundsException in Saxon 8.6

OK thanks for the update. I think I'm going to have to try and produce a diagnostic patch for you to install, if you would be willing. (As it's on an exception path, I may simply build this into, which I need to release soon anyway).
Michael Kay

From: Ackley, Paul [mailto:Paul.Ackley@qwest.com]
Sent: 12 March 2009 15:48
To: Mailing list for the SAXON XSLT and XQuery processor
Cc: Ackley, Paul
Subject: Re: [saxon] ArrayIndexOutOfBoundsException in Saxon 8.6

Update for this issue... the upgrade to saxon9 did not correct the issue.  It still occurrs after about 2 - 3 days of up time for the application we start to see this exception:
java.lang.ArrayIndexOutOfBoundsException: 5
 at net.sf.saxon.om.NamespaceIterator.getInScopeNamespaceCodes(NamespaceIterator.java:288)
 at net.sf.saxon.tree.ElementImpl.getInScopeNamespaceCodes(ElementImpl.java:670)
 at net.sf.saxon.style.LiteralResultElement.validate(LiteralResultElement.java:200)
 at net.sf.saxon.style.StyleElement.validateSubtree(StyleElement.java:1234)
 at net.sf.saxon.style.StyleElement.validateChildren(StyleElement.java:1263)
 at net.sf.saxon.style.StyleElement.validateSubtree(StyleElement.java:1238)
 at net.sf.saxon.style.StyleElement.validateChildren(StyleElement.java:1263)
 at net.sf.saxon.style.StyleElement.validateSubtree(StyleElement.java:1238)
 at net.sf.saxon.style.XSLStylesheet.preprocess(XSLStylesheet.java:705)
 at net.sf.saxon.PreparedStylesheet.setStylesheetDocument(PreparedStylesheet.java:331)
 at net.sf.saxon.PreparedStylesheet.prepare(PreparedStylesheet.java:163)
 at net.sf.saxon.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:139)
 at weblogic.xml.jaxp.RegistryTransformerFactory.newTemplates(RegistryTransformerFactory.java:173)
Once I restart the application it all works fine.  There seems to be plenty of free memory available and other transformers still seem to work okay.  It seems rather random as it's not always the same style sheets which have issues.
I'm really at a loss as to what the problem could be.  I cannot purposefully create the issue by stressing the application... and this latest time the application only had 38 transformations over the span of 3 days before the problem started to happen....
The application is running in a WebLogic 9.2 App Server using Java 1.5.0_10