You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Holger Ebert <ho...@media-engineering.de> on 2000/06/24 12:14:33 UTC
Redirect-Extension
I am using the redirect extension to generate multiple Html-Files from
one Xml-File. When starting Xalan from the commandline with
java -cp xalan.jar;xerces.jar;bsf.jar;bsfengine.jar
org.apache.xalan.xslt.Process -in test.xml -xsl generate.xsl -out
generate.html
everything works fine.
I want to use this within an application, when starting with
processor = XSLTProcessorFactory.getProcessor();
// Create the 3 objects the XSLTProcessor needs to perform the
transformation.
XSLTInputSource xmlSource = new XSLTInputSource("test.xml");
XSLTInputSource xslSheet = new XSLTInputSource("generate.xls");
XSLTResultTarget xmlResult = new XSLTResultTarget("generate.html");
// Perform the transformation.
processor.process(xmlSource, xslSheet, xmlResult);
i got the following exceptions
Call to extension function failed: method call/new failed:
java.lang.reflect.InvocationTargetException target exception:
java.lang.RuntimeException: Function not supported!
All of the files are generated but they are empty.
Any suggestions?
Holger Ebert
Re: Redirect-Extension
Posted by Edwin Glaser <ed...@pannenleiter.de>.
You wrote:
> i got the following exceptions
May be you will see what happend when you look at the stacktrace of
the embedded exception. The following method often returns some
usefull information:
public String info(Throwable t)
{
StringWriter buf = new StringWriter();
PrintWriter out = new PrintWriter(buf);
for (int i = 0; i < 10 && t != null; i++ )
{
if ( t instanceof java.lang.reflect.InvocationTargetException )
{
t = ((java.lang.reflect.InvocationTargetException)t).getTargetException();
}
if ( t instanceof org.xml.sax.SAXParseException )
{
String uri = ((org.xml.sax.SAXParseException)t).getSystemId();
out.println("URL: " + uri);
out.println("Line: " + ((org.xml.sax.SAXParseException)t).getLineNumber());
out.println("Column: " + ((org.xml.sax.SAXParseException)t).getColumnNumber());
}
t.printStackTrace(out);
if ( t instanceof org.xml.sax.SAXException )
{
t = ((org.xml.sax.SAXException)t).getException();
}
else
{
t = null;
}
}
return buf.toString();
}
Hope it helps, edwin
--
Edwin Glaser -- edwin@pannenleiter.de