Hi there,
running the xslt sample under Java 1.3 (using Xalan) and Java 1.4 (out
of the box) works flawlessly.
Yet, if running it with 1.5 (and 1.6beta for tha tmatter) yields the
following exception:
--------------- cut here -----------------
F:\work\svn\bsf\samples\xsl>java TableFiller style1.xsl table-data.xml
ERROR: 'The first argument to the non-static Java function 'add' is not a
valid object reference.'
FATAL ERROR: 'Could not compile stylesheet'
javax.xml.transform.TransformerConfigurationException: Could not compile
stylesheet
at
com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTemplates(Transfor
merFactoryImpl.java:824)
at
com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTransformer(Transf
ormerFactoryImpl.java:619)
at org.apache.bsf.engines.xslt.XSLTEngine.eval(XSLTEngine.java:132)
at org.apache.bsf.util.BSFEngineImpl.exec(BSFEngineImpl.java:177)
at org.apache.bsf.BSFManager$6.run(BSFManager.java:518)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.bsf.BSFManager.exec(BSFManager.java:516)
at TableFiller.main(TableFiller.java:48)
Sep 12, 2006 5:07:00 PM org.apache.bsf.BSFManager exec
SEVERE: Exception :
java.security.PrivilegedActionException: org.apache.bsf.BSFException: Exception
from Xerces XSLT: ja
vax.xml.transform.TransformerConfigurationException: Could not compile
stylesheet
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.bsf.BSFManager.exec(BSFManager.java:516)
at TableFiller.main(TableFiller.java:48)
Caused by: org.apache.bsf.BSFException: Exception from Xerces XSLT:
javax.xml.transform.TransformerC
onfigurationException: Could not compile stylesheet
at org.apache.bsf.engines.xslt.XSLTEngine.eval(XSLTEngine.java:135)
at org.apache.bsf.util.BSFEngineImpl.exec(BSFEngineImpl.java:177)
at org.apache.bsf.BSFManager$6.run(BSFManager.java:518)
... 3 more
Exception in thread "main" org.apache.bsf.BSFException: Exception from Xerces
XSLT: javax.xml.transf
orm.TransformerConfigurationException: Could not compile stylesheet
at org.apache.bsf.engines.xslt.XSLTEngine.eval(XSLTEngine.java:135)
at org.apache.bsf.util.BSFEngineImpl.exec(BSFEngineImpl.java:177)
at org.apache.bsf.BSFManager$6.run(BSFManager.java:518)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.bsf.BSFManager.exec(BSFManager.java:516)
at TableFiller.main(TableFiller.java:48)
--------------- cut here -----------------
Would anyone have an idea what the error might be ?
Here is the stylesheet "style1.xsl":
--------------- cut here -----------------
<?xml version='1.0'?>
<!-- This stylesheet fills in the data by sorting on the first name. -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:java="http://xml.apache.org/xslt/java"
version="1.0">
<!-- get access to the panel -->
<xsl:param name="panel"/>
<xsl:template match="data">
<xsl:apply-templates select="person">
<xsl:sort select="@first"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="person">
<xsl:variable name="junk1" select="java:add ($panel, java:java.awt.Label.new
(string(@first)))"/>
<xsl:variable name="junk2" select="java:add ($panel, java:java.awt.Label.new
(string(@last)))"/>
</xsl:template>
</xsl:stylesheet>
--------------- cut here -----------------
Here is the datafile "table-data.xml":
--------------- cut here -----------------
<?xml version="1.0"?>
<data>
<person first="Sanjiva" last="Weerawarana"/>
<person first="Matt" last="Duftler"/>
<person first="Paco" last="Curbera"/>
<person first="Sam" last="Ruby"/>
<person first="Stephen" last="Boies"/>
</data>
--------------- cut here -----------------
Running it with:
java TableFiller style1.xsl table-data.xml
yields the exception above; again only under 1.5 and 1.6.
Any hints appreciated!
Regards,
---rony