Hi all,
I'm using the <?xalan-doc-cache-off?> PI in the <xsl:for-each> element:
<xsl:template name="lookup-module">
<xsl:for-each select="document(@id)/module/*[not(self::meta)]">
<?xalan-doc-cache-off?>
<xsl:copy-of select="."/>
</xsl:for-each>
</xsl:template>This works fine for the first call to "lookup-module", but for the second call I get the following stack:
java.lang.RuntimeException: java.lang.ArrayIndexOutOfBoundsException
at org.apache.xalan.transformer.TransformerImpl.run(TransformerImpl.java:3418)
at org.apache.xalan.transformer.TransformerHandlerImpl.endDocument(TransformerHandlerImpl.java:389)
at de.docufy.cms.commons.punit.Configuration.toSAX(Configuration.java:187)
at de.docufy.cms.cmspublish.CMSPublish.createResultByConfiguration(CMSPublish.java:200)
at de.docufy.cms.cmspublish.CMSPublish.createFileByConfigFile(CMSPublish.java:132)
at de.docufy.cms.cmspublish.Main.main(Main.java:45)
Exception in thread "main"
Xalan catches some Exception in TransformerImpl and throws the RuntimeException there. Guess the original Exception came from that code part in org.apache.xpath.SourceTreeManager:
/** JJK: Support <?xalan:doc_cache_off?> kluge in ElemForEach.
* TODO: This function is highly dangerous. Cache management must be improved.
*
* @param n The node to remove.
*/
public void removeDocumentFromCache(int n)
{
if(DTM.NULL ==n)
return;
for(int i=m_sourceTree.size()-1;i>=0;--i)
{
SourceTree st=(SourceTree)m_sourceTree.elementAt(i);
if(st!=null && st.m_root==n)
{
m_sourceTree.removeElementAt(i);
return;
}
}
}
However, when I invoce my stylesheets with the org.apache.xalan.xslt.Process processor, the error doesn't occur. It only occurs when I use my own wrapper, which uses TransformerHandler classes set up with Templates stylesheets. In the URIResolver I return a DOMSource to the processor.
Any ideas will be welcome.
Thx
Christian
