You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "Sergei S. Ivanov" <iv...@aha.ru> on 2000/07/11 20:23:39 UTC

Problem using Xalan precompiled stylesheets

I've just tried to use xslt precompilation feature of xalan and failed.
Xalan ver: 1.1.D01
Problem:
When running xslt processor from command line like this:

java org.apache.xalan.xslt.Process -xsl foo.xsl -lxcout foo.xslc -edump

...I've got a stack dump:

java.io.NotSerializableException:
org.apache.xalan.xpath.xml.StringToStringTable
        at java.io.ObjectOutputStream.outputObject(Unknown Source)
        at java.io.ObjectOutputStream.writeObject(Unknown Source)
        at java.io.ObjectOutputStream.outputClassFields(Unknown Source)
        at java.io.ObjectOutputStream.defaultWriteObject(Unknown Source)
        at
org.apache.xalan.xslt.ElemTemplateElement.writeObject(ElemTemplateElement.ja
va:252)
        ...

Changing StringToStringTable to implement Serializable solves the storage
problem, but transformation using the compiled stylesheet fails. The problem
occurs when the stylesheet uses top-level params:

java.lang.NullPointerException
        at
org.apache.xalan.xslt.Stylesheet.createXPath(Stylesheet.java:1306)
        at
org.apache.xalan.xslt.Stylesheet.pushTopLevelVariables(Stylesheet.java:964)
        at
org.apache.xalan.xslt.XSLTEngineImpl.resolveTopLevelParams(XSLTEngineImpl.ja
va:3035)
        at
org.apache.xalan.xslt.StylesheetRoot.process(StylesheetRoot.java:432)
        at org.apache.xalan.xslt.Process.main(Process.java:507)

After some investigation of the code I guess that init() or initXPath()
method of Stylesheet should be called just after the deserialization or in
the body of process() method.

Looking forward for comments from Xalan developers,
--
Sergei S. Ivanov  sergei_ivanov@object-tools.com
Object Tools, Moscow  http://www.object-tools.com