xsl-list
[Top] [All Lists]

Error when moving from Xalan to Saxon

2004-11-03 07:49:50
Hi,
I dont know if this is the correct forum to put the
quesiton, but maybe somebody can help me out.

I have a simple java class to transform a XML using a
XSL to a HTML. Here is the java code.

///////////////////
import java.io.*;

import javax.xml.transform.Transformer;
import
javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;

public class TransformerTest
{
        public static void main(String[] args)
    throws TransformerException,
TransformerConfigurationException,
           FileNotFoundException, IOException
  {
        String strXSLFile = "ToHTML.XSL";
        String xmlFileName = "MyXML.xml";


System.setProperty("javax.xml.transform.TransformerFactory","net.sf.saxon.TransformerFactoryImpl");
        System.out.println("JRE HOME                  =
"+System.getProperty("java.home"));
        System.out.println("JRE VERSION               =
"+System.getProperty("java.version"));


        TransformerFactory tFactory =
TransformerFactory.newInstance();

        Transformer transformer = tFactory.newTransformer(new
StreamSource(strXSLFile));

        System.out.println("TransformerFactory  class =
"+tFactory.getClass().getName());
        System.out.println("Transformer class         =
"+transformer.getClass().getName());

        transformer.transform(new StreamSource(xmlFileName),
new StreamResult(new FileOutputStream("tpc.out")));
  }
}
/////////////

I am running this java class in WSAD (IBM Websphere
Studio Aplication Developer). I have the saxon8.jar in
my classpath.
I get the gollowing error while running it.
/////////
JRE HOME                  = C:\Program
Files\IBM\WebSphere Studio\Application
Developer\v5.1\runtimes\base_v5\java\jre
JRE VERSION               = 1.3.1

java.lang.NoClassDefFoundError:
java/lang/AssertionError
        at java.lang.Class.forName1(Native Method)
        at java.lang.Class.forName(Class.java:142)
        at
net.sf.saxon.functions.ExtensionFunctionFactory.class$(ExtensionFunctionFactory.java:16)
        at
net.sf.saxon.functions.ExtensionFunctionFactory.<init>(ExtensionFunctionFactory.java:16)
        at
net.sf.saxon.Configuration.<init>(Configuration.java:62)
        at
net.sf.saxon.TransformerFactoryImpl.<init>(TransformerFactoryImpl.java:48)
        at java.lang.Class.newInstance0(Native Method)
        at java.lang.Class.newInstance(Class.java:262)
        at
javax.xml.transform.FactoryFinder.newInstance(Unknown
Source)
        at javax.xml.transform.FactoryFinder.find(Unknown
Source)
        at
javax.xml.transform.TransformerFactory.newInstance(Unknown
Source)
        at TransformerTest.main(TransformerTest.java:33)
Exception in thread "main" 
/////////

Has any body come acrosss this error. Any pointers
will be highly appreciated.
regards,
Bhupendra.


        
        
                
___________________________________________________________ALL-NEW Yahoo! 
Messenger - all new features - even more fun! http://uk.messenger.yahoo.com


<Prev in Thread] Current Thread [Next in Thread>