Here are the answers to environment questions.
Pierre
Sorry, but it is very difficult to help without more information. In your
original post, you refer to problems with a translet called "db2html", but
you need to provide more details about that.
Exactly how you start the transformation (command line, your own Java class,
...)?
I start from My own class and I'me now able to have a best message error :
javax.xml.transform.TransformerConfigurationException: Chargement
impossible de la classe translet 'db2html'.
at
com.sun.org.apache.xalan.internal.xsltc.trax.TemplatesImpl.defineTransletClasses(TemplatesImpl.java:315)
at
com.sun.org.apache.xalan.internal.xsltc.trax.TemplatesImpl.getTransletInstance(TemplatesImpl.java:333)
at
com.sun.org.apache.xalan.internal.xsltc.trax.TemplatesImpl.newTransformer(TemplatesImpl.java:366)
at
com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTransformer(TransformerFactoryImpl.java:620)
at
fr.tireme.utilities.xml.xslt.ProcessFromCommandLine.main(ProcessFromCommandLine.java:111)
Line 111 corresponds to the following code line :
Transformer transformer = tfactory.newTransformer(new
StreamSource(xslFileName));
The stylesheet I use is the folowing one where, for test purpose, I've
simplfied up to the simplest import.
NOTE that if I use the docbook.xsl it works, it is only while importing
that it does not works !
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://www.w3.org/1999/xhtml" version="1.0"
xmlns:doc="http://nwalsh.com/xsl/documentation/1.0"
exclude-result-prefixes="doc">
<xsl:import href="../docbook-xsl/xhtml/docbook.xsl"/>
</xsl:stylesheet>
What is on your classpath? What does your source XML look like? Did
you try a different (perhaps non-Java) processor to see if the stylesheets
work with it?
Standard within an eclipse environment : only the JDK which meands rt.jar,
etc.
Note, the Java class looks like :
try {
PrintWriter resultWriter;
StreamResult strResult;
if (null != outFileName) {
strResult = new StreamResult(new
FileOutputStream(outFileName));
strResult.setSystemId(outFileName);
} else {
strResult = new StreamResult(System.out);
}
TransformerFactory tfactory = TransformerFactory.newInstance();
Transformer transformer = tfactory.newTransformer(new
StreamSource(
xslFileName));
int nParams = params.size();
for (int ii = 0; ii < nParams; ii += 2) {
transformer.setParameter((String) params.elementAt(ii),
(String) params.elementAt(ii + 1));
}
transformer.transform(new StreamSource(inFileName), strResult);
}
Pierre Attar (mailto:pat@tireme.fr)
Consultant en informatique documentaire XML
Consultant in Structured Document engineering
Projet "Mutualiser l'effort de montée en compétences sur XML"
http://www.mutu-xml.org/index.html