Darryl Andrew

Greenhorn
+ Follow
since Jun 21, 2001
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Darryl Andrew

Originally posted by Beno�t d'Oncieu:
Hi Chris,
What transformation engine are you using? For me, the fixed example works fine with Xalan2-Java and with Microsoft IE5.5.
As an alternative to Sumedh's fix, you can also use:
<xsl:value-of select=".//GstBk:Name" />
This selects all the descending nodes (.//GstBk:Name is a shortcut for self::node()/descendant-or-self::node()/GstBk:Name)
Cheers,
Beno�t


Hi, since u r using xalan2, can u pls tell me what are the path to use? i include xalan2.jar, xerces.jar, xalanservlet.jar and servlet.jar in my path when running the servlet example provided in xml.apache.org using xalan2.jar. But i'm still experiencing java.lang.NoClassDefFoundError error
Hi, i'm using manta Linux, and can't find the JRE/lib/root directory. Pls help. Thanx.
Hi, i run a servlet example but couldn't work the error is as follows: -
java.lang.IncompatibleClassChangeError: Unimplemented interface method
at org.apache.xalan.processor.XSLTSchema.class$(XSLTSchema.java:69)
at org.apache.xalan.processor.XSLTSchema.build(XSLTSchema.java:253)
at org.apache.xalan.processor.XSLTSchema.(XSLTSchema.java:77)
at org.apache.xalan.processor.StylesheetHandler.(StylesheetHandler.java:1228)
at org.apache.xalan.processor.TransformerFactoryImpl.newTemplatesHandler(TransformerFactoryImpl.java:434)
at org.apache.xalan.processor.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:742)
at org.apache.xalan.processor.TransformerFactoryImpl.newTransformer(TransformerFactoryImpl.java:669)
at invoice.service(invoice.java:33)
at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java)
at org.apache.tomcat.core.Handler.service(Handler.java)
at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java)
at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java)
at org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnection(Ajp12ConnectionHandler.java)
at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java)
at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java)
at java.lang.Thread.run(Thread.java)
and my servlet code are:-
import java.io.*;
public class invoice extends javax.servlet.http.HttpServlet {
// Respond to HTTP GET requests from browsers.
public void service (javax.servlet.ServletRequest request,
javax.servlet.ServletResponse response)
throws javax.servlet.ServletException, java.io.IOException
{
// Set content type for HTML.
response.setContentType("text/html; charset=UTF-8");
// Output goes to the response PrintWriter.
java.io.PrintWriter out = response.getWriter();
File fo1 = new File("/home/darryl/invoice.xml");
File fo2 = new File("/home/darryl/invoice.xsl");
try
{
javax.xml.transform.TransformerFactory tFactory =
javax.xml.transform.TransformerFactory.newInstance();
// Get the XML input document and the stylesheet, both in the servlet
// engine document directory.
javax.xml.transform.Source xmlSource =
new javax.xml.transform.stream.StreamSource(fo1);
// (new
// FileInputStream("/home/osbmaster/www/invoice/invoice.xml"));
javax.xml.transform.Source xslSource =
new javax.xml.transform.stream.StreamSource(fo2);
// (new
// FileInputStream("/home/osbmaster/www/invoice/invoice.xsl"));
// Generate the transformer.
javax.xml.transform.Transformer transformer = tFactory.newTransformer(xslSource);
// Perform the transformation, sending the output to the response.
transformer.transform(xmlSource,
new javax.xml.transform.stream.StreamResult(out));
}
// If an Exception occurs, return the error to the client.
catch (Exception e)
{
out.write(e.getMessage());
e.printStackTrace(out);
}
// Close the PrintWriter.
out.close();
}
}
~~
Can anybody tell me wat's wrong with the servlet code above?
looks like the whole bunch of code do not work in xalan2 anymore.
Anybody has any luck working with xalan2 using TransformerFactory??
Hi thanx for the reply, but my company would specifically like to work with what they have now and that is xalan2, so i don't think i have an option here.
Looks like xalan2 no longer support XSLTProcessor class.
Hi, everyone, i'm running my servlet to do xml transformation using xalan. Everything was running fine until recently i faced the following error.
java.lang.IncompatibleClassChangeError: Unimplemented interface method
at org.apache.xalan.xpath.dtm.DTMNodeVector.(DTMNodeVector.java:69)
at org.apache.xalan.xpath.dtm.DTM.(DTM.java:309)
at org.apache.xalan.xpath.dtm.DTMLiaison.parse(DTMLiaison.java:198)
at org.apache.xalan.xslt.XSLTEngineImpl.getSourceTreeFromInput(XSLTEngineImpl.java:955)
at org.apache.xalan.xslt.XSLTEngineImpl.process(XSLTEngineImpl.java:643)
at invoice.service(invoice.java:50)
at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java)
at org.apache.tomcat.core.Handler.service(Handler.java)
at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java)
at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java)
at org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnection(Ajp12ConnectionHandler.java)
at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java)
at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java)
at java.lang.Thread.run(Thread.java)
my code is as follows:-
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import org.apache.xalan.xslt.*;
import java.util.*;
public class invoice extends HttpServlet {
String path;
public void init(){
ResourceBundle bundle = ResourceBundle.getBundle("invoice");
try{
// Set default path as stated in the properties file.
path = bundle.getString("defaultPath");
}catch(Exception e){}
}
public void service(javax.servlet.ServletRequest req,
javax.servlet.ServletResponse res)
throws javax.servlet.ServletException, java.io.IOException
{
/* // default path
String path ="/home/inv/"; */
String in = "";
String sheet = "";
String tempxml = req.getParameter("xmlfilename");
String tempxsl = req.getParameter("xslfilename");
if (tempxml.charAt(0) == '/')
in = tempxml;
else
in = path + tempxml;
if (tempxsl.charAt(0) == '/')
sheet = tempxsl;
else
sheet = path + tempxsl;
// Transform
try {
XSLTProcessor processor = XSLTProcessorFactory.getProcessor();
processor.process(new XSLTInputSource(new FileInputStream(in)),
new XSLTInputSource(new FileInputStream(sheet)),
new XSLTResultTarget(res.getOutputStream()));
} catch (Exception e) {
PrintWriter out = res.getWriter();
out.println("Error: " + e + ". ");
out.println("<a href=/osb/invoice/>Try again</a>");
out.close();
}
//return;
}
}
I will be very grateful if someone can tell me wat's wrong.

Originally posted by Ajith Kallambella:
Try moving the jar files to JREROOT\lib\ext directory.


Hi, thanx for the reply. I have solved the problem by specifying the CLASSPATH in the tomcat conf files, tomcat.sh or jspc.sh

Hi does anyone know how to specify the classpath to xalan.jar and xerces.jar in the tomcat server so that my servlet would be able to run from any browser?
I'm able to compile my java file after export the classpath to include xalan.jar and xerces.jar but this is only for my local shell. If i'm not wrong, we have to specify it in tomcat so tat i would be able to see the servlet from the browser. Am i right?
Pls help. Thank you.
Hi, can u post the jsp code for using xml and xsl to do the transformation?
There are servlets codes to do the same thing in this forum, but i would like to know how to do it with jsp.
Anyway, i believe the code for servlet and jsp should not be the same. Am i right to say that?
thanx

Originally posted by Bill Pearce:
[B]As requested, here is my complete service method for using a URL to another servlet as the source of your XML document:

Hope this helps,
Bill
[This message has been edited by Bill Pearce (edited September 19, 2000).][/B]


Hi, i have no problem when i compiled the java program but encountered the below error when using my browser to view the servlet.
Error: java.lang.ClassNotFoundException: org.apache.xalan.xslt.XSLTProcessorFactory
PLs help. I have already set my classpath to xalan.jar and xerces.jar.
I'm using Xalan on manta-Linus. Thanx.
Hi, i did not use a Weblogic server, i'm using tomcat.
I also did not have parser.jar in my folder and xalan.jar is before xerces.jar in my classpath but i still get the following error when i access the servlet from the browser.
Error: java.lang.ClassNotFoundException: org.apache.xalan.xslt.XSLTProcessorFactory
Can anybody pls help?