>> Transformer t = tf.newTransformer(new
>> StreamSource(GeneratedTranslet.class.getName()));//Fails here
The systemID of a StreamSource is normally in uri format. It will not
interpret the String "test.xsl.GeneratedTranslet" as the full translet
class name. You can do the following instead:
tf.setAttribute("package-name", "test.xsl");
tf.setAttribute("translet-name", "GeneratedTranslet");
If you set the above two attributes, the argument to StreamSource can be
set to anything (even null).
Regards,
Morris Kwan
XSLT Development
IBM Toronto Lab
Tel: (905)413-3729
Email: [EMAIL PROTECTED]
"Jeremy Nix"
<[EMAIL PROTECTED]
d.com> To
<[EMAIL PROTECTED]>
11/07/2003 09:17 cc
AM
Subject
Problems specifying generated
translet when creating Transformer
I've generated a translet using the command line utility:
java -classpath org.apache.xalan.xsltc.cmdline.Compile -o
GeneratedTranslet -p test.xsl -j xsl.
jar test.xsl
I then try to run the following code to perform my transformation:
System.setProperty("javax.xml.transform.TransformerFactory","org.apache.
xalan.xsltc.trax.TransformerFactoryImpl");
TransformerFactory tf = TransformerFactory.newInstance();
try
{
tf.setAttribute("use-classpath", Boolean.TRUE);
}
catch (IllegalArgumentException iae)
{
System.err.println("Could not set XSLTC-specific
TransformerFactory attributes. Transformation failed.");
}
Transformer t = tf.newTransformer(new
StreamSource(GeneratedTranslet.class.getName()));//Fails here
t.transform(new JDOMSource(xml), new StreamResult(System.out));
This produces the following error:
javax.xml.transform.TransformerConfigurationException: Cannot find class
'test_xsl'.
at
org.apache.xalan.xsltc.trax.TransformerFactoryImpl.newTemplates(Transfor
merFactoryImpl.java:596)
at
org.apache.xalan.xsltc.trax.TransformerFactoryImpl.newTransformer(Transf
ormerFactoryImpl.java:520)
at
test.xsl.GeneratedTransletTest.testTranslet(GeneratedTransletTest.java:1
71)
Is there something underlying that I am missing? Also, why would it
tell me that it could not find the class test.xml, when I'm specifying
test.xml.GeneratedTranslet?
_________________________________
Jeremy Nix
Southwest Financial Services, LTD.
[EMAIL PROTECTED]
(513) 621-6699 ext.1158