[jdom-interest] XSLT Question??? Help!!!!

Luis Castro luic at gwl.com
Thu Sep 20 09:20:23 PDT 2001


Hi, I'm new to JDOM API's. So, trying to run one of the examples from the 
/samples package I got the following run-time error:

Source Code:

import org.jdom.*;
import org.jdom.input.*;
import org.jdom.output.*;
import org.jdom.transform.*;
import javax.xml.transform.*;
import javax.xml.transform.stream.*;

public class XSLTransform {

  public static void main(String[] args) throws Exception {
    SAXBuilder builder = new SAXBuilder();
    Document doc = builder.build(args[0]);
    Document doc2 = transform(doc, args[1]);
    XMLOutputter out = new XMLOutputter("  ", true);
    out.setTextNormalize(true);
    out.output(doc2, System.out);
  }

  public static Document transform(Document in, String stylesheet) 
                              throws JDOMException {
    try {
      Transformer transformer = TransformerFactory.newInstance()
        .newTransformer(new StreamSource(stylesheet));
  
      JDOMResult out = new JDOMResult();
      transformer.transform(new JDOMSource(in), out);
      return out.getDocument();
    }
    catch (TransformerException e) {
      throw new JDOMException("XSLT Transformation failed", e);
    }
  }
}





Run-time Error Description:

gp-elf% java XSLTransform catalog.xsl catalog.xml

Exception in thread "main" org.jdom.JDOMException: XSLT Transformation failed: 
javax.xml.transform.TransformerConfigurationException: 
javax.xml.transform.TransformerException: java.lang.ClassNotFoundException: 
org.apache.crimson.parser.XMLReaderImpl
        at XSLTransform.transform(XSLTransform.java, Compiled Code)
        at XSLTransform.main(XSLTransform.java, Compiled Code)
Root cause: javax.xml.transform.TransformerConfigurationException: 
javax.xml.transform.TransformerConfigurationException: 
javax.xml.transform.TransformerException: java.lang.ClassNotFoundException: 
org.apache.crimson.parser.XMLReaderImpl
        at 
org.apache.xalan.processor.TransformerFactoryImpl.newTransformer(TransformerFact
oryImpl.java, Compiled Code)
        at XSLTransform.transform(XSLTransform.java, Compiled Code)
        at XSLTransform.main(XSLTransform.java, Compiled Code)


Notes:
I config my CLASSPATH with jaxp.jar, crimson.jar and xalan.jar. If there is 
anything else that I need in my config.????
My environment is UNIX.

Thanks
Luis




More information about the jdom-interest mailing list