You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "Winkley, Dennis x66244" <DW...@bis.adp.com> on 2000/09/22 23:55:09 UTC

Error on Solaris but not on NT

I am attempting to transform an existing xerces created DOM and receive the
following error when I run it on Solaris:

XSL Error: Cannot use a DTMLiaison for a input DOM node... pass a
org.apache.xalan.xpath.xdom.XercesLiaison instead!
XSL Error: SAX Exception
*** Transformation failed - failed to sort data
org.apache.xalan.xslt.XSLProcessorException: 
	at java.lang.Throwable.fillInStackTrace(Native Method)
	at java.lang.Throwable.fillInStackTrace(Compiled Code)
	at java.lang.Throwable.<init>(Compiled Code)
	at java.lang.Exception.<init>(Compiled Code)
	at org.xml.sax.SAXException.<init>(SAXException.java:45)
	at
org.apache.xalan.xpath.XPathException.<init>(XPathException.java:92)
	at
org.apache.xalan.xslt.XSLProcessorException.<init>(XSLProcessorException.jav
a:77)
	at
org.apache.xalan.xslt.XSLTEngineImpl.error(XSLTEngineImpl.java:1720)
	at
org.apache.xalan.xslt.XSLTEngineImpl.error(XSLTEngineImpl.java:1612)
	at
org.apache.xalan.xslt.XSLTEngineImpl.getSourceTreeFromInput(XSLTEngineImpl.j
ava:844)
	at org.apache.xalan.xslt.XSLTEngineImpl.process(Compiled Code)
	at adpsis.posse.posseXML.PosseXMLDOM.Sort(Compiled Code)
	at
adpsis.posse.baseClass.StatelessTransactionEJB.loadSortedResult(StatelessTra
nsactionEJB.java:757)
	at
adpsis.posse.inqpos.InqposStockRecordsEJBEOImpl.loadSortedResult(InqposStock
RecordsEJBEOImpl.java:258)
	at
adpsis.posse.inqpos.InqposStockRecordsBean.processRequest(Compiled Code)
	at
adpsis.jsp.posse.jsp_main.inqpos_stock_records._jspService(inqpos_stock_reco
rds.java:149)
	at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
	at weblogic.servlet.internal.ServletStubImpl.invokeServlet(Compiled
Code)
	at
weblogic.servlet.internal.ServletContextImpl.invokeServlet(Compiled Code)
	at weblogic.servlet.JSPServlet.service(JSPServlet.java:132)
	at javax.servlet.http.HttpServlet.service(Compiled Code)
	at weblogic.servlet.internal.ServletStubImpl.invokeServlet(Compiled
Code)
	at
weblogic.servlet.internal.ServletContextImpl.invokeServlet(Compiled Code)
	at
weblogic.servlet.internal.ServletContextImpl.invokeServlet(Compiled Code)
	at weblogic.socket.MuxableSocketHTTP.invokeServlet(Compiled Code)
	at weblogic.socket.MuxableSocketHTTP.execute(Compiled Code)
	at weblogic.t3.srvr.ExecuteThread.run(Compiled Code)   

However, when I run the code on NT (where I developed it) it works
perfectly.  The code I'm using follows:

		XSLTInputSource xml = new
XSLTInputSource(xdom.getDocumentElement());
		StringBuffer xslString = new StringBuffer(stylesheet);
		XSLTInputSource xsl = new XSLTInputSource(new
StringReader(xslString.toString()));
		StringWriter resultString = new StringWriter();
		XSLTResultTarget result = new
XSLTResultTarget(resultString);
		XSLTProcessor transform = null;
		try
		{
			transform = XSLTProcessorFactory.getProcessor();
		}
		catch(Exception e)
		{
			System.out.println("*** Could not create
XSLTProcessor - failed to sort data");
			e.printStackTrace();
			return;
		}
		try
		{
			transform.process(xml, xsl, result);
		}
		catch(Exception e)
		{
			System.out.println("*** Transformation failed -
failed to sort data");
			e.printStackTrace();
			return;
		}

The first question is does anyone know why I would get different results on
the two platforms?  

The second question what can I do about it?  Is there a way to force the use
of a XercesLiaison instead of attempting to use a DTMLiaison?

thanx for the help
Dennis

Re: Error on Solaris but not on NT

Posted by Gary L Peskin <ga...@firstech.com>.
"Winkley, Dennis x66244" wrote:
> 
> I am attempting to transform an existing xerces created DOM and receive the
> following error when I run it on Solaris:
> 
> XSL Error: Cannot use a DTMLiaison for a input DOM node... pass a
> org.apache.xalan.xpath.xdom.XercesLiaison instead!
> [snip]
> 
> However, when I run the code on NT (where I developed it) it works
> perfectly.  The code I'm using follows:
> 
>                 XSLTInputSource xml = new
> XSLTInputSource(xdom.getDocumentElement());
>                 StringBuffer xslString = new StringBuffer(stylesheet);
>                 XSLTInputSource xsl = new XSLTInputSource(new
> StringReader(xslString.toString()));
>                 StringWriter resultString = new StringWriter();
>                 XSLTResultTarget result = new
> XSLTResultTarget(resultString);
>                 XSLTProcessor transform = null;
>                 try
>                 {
>                         transform = XSLTProcessorFactory.getProcessor();
>                 }
>                 catch(Exception e)
>                 {
>                         System.out.println("*** Could not create
> XSLTProcessor - failed to sort data");
>                         e.printStackTrace();
>                         return;
>                 }
>                 try
>                 {
>                         transform.process(xml, xsl, result);
>                 }
>                 catch(Exception e)
>                 {
>                         System.out.println("*** Transformation failed -
> failed to sort data");
>                         e.printStackTrace();
>                         return;
>                 }
> 
> The first question is does anyone know why I would get different results on
> the two platforms?
> 
> The second question what can I do about it?  Is there a way to force the use
> of a XercesLiaison instead of attempting to use a DTMLiaison?

Dennis --

To answer your first question, we need to know the type of xdom.  Xalan
defaults to a DTMLiaison but will automatically switch to a
XercesLiaison if xdom is an instance of org.apache.xerces.dom.NodeImpl. 
Is it possible that you're building xdom with Xerces on NT but another
XML parser or DOM builder on Solaris?

To force a XercesLiaison, change your getProcessor call to:

  transform =
XSLTProcessorFactory.getProcessor("org.apache.xalan.xpath.xdom.XercesLiaison");

HTH,
Gary