Hi, Sagara.

Henry Zongaro/Toronto/[EMAIL PROTECTED] wrote on 2007-11-06 05:45:45 AM:
> "sagara" <[EMAIL PROTECTED]> wrote on 2007-11-06 03:07:30 AM:
> > I try to use translets within a web application. My environment is 
> > tomcat 5.5 and jdk 1.5, I wrote a small JSP page and try to load 
> > compiled translet class in to an input source and execute the 
> > transformation. Then I got following error message. 
> > 
> > (Location of error unknown) org.apache.xerces.impl.io.
> > MalformedByteSequenceException : Invalid byte 2 of 2-byte UTF-8 
sequence. 
> 
> That error message is reporting a problem in the encoding of an XML 
> document - probably your person.xml document.  Can you show us that 
document?

Now I see the problem.  In the following fragment, you've specifed the 
translet class file name in the StreamSource.  In fact, the argument to 
StreamSource should still be the URI for the stylesheet, even with the 
use-classpath argument.  XSLTC simply uses that URI to determine the name 
of the translet class, and as long as the "person" translet class (and any 
of its ancillary classes) are on the class path, XSLTC will find them 
without recompiling the stylesheet.  If it fails to find them, XSLTC will 
report an error.

"sagara" <[EMAIL PROTECTED]> wrote on 2007-11-06 03:07:30 AM:
> //    JSP page 
> //  String transletName = "e:/person.xsl";
>     String transletName = "e:/person.class";
[HZ:Deleted some code]
>                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(transletName));

I hope that helps.

Thanks,

Henry
------------------------------------------------------------------
Henry Zongaro      XSLT Processors Development
IBM SWS Toronto Lab   T/L 313-6044;  Phone +1 905 413-6044
mailto:[EMAIL PROTECTED]

Reply via email to