You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Edwin Goei <Ed...@eng.sun.com> on 2001/03/07 03:13:25 UTC

xalan 2 in applet

While debugging an applet, I ran into a problem with xalan 2 where the
code tries to read System properties.  A proposed patch is attached.

I also ran into a second problem that I haven't figured out yet.  The
relevant snippet is:

    Transformer transformer = tf.newTransformer(
        new StreamSource(getClass().getResourceAsStream(
            "data/stylesheet.txt")));

    Properties props = transformer.getOutputProperties();
    System.out.println("props:");
    props.list(System.out);
    
    StreamSource quoteInput = new StreamSource(
        getClass().getResourceAsStream("data/quote.txt"));
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    StreamResult quoteOutput = new StreamResult(baos);
    transformer.transform(quoteInput, quoteOutput);

The problem occurs in the transformer.transform() method.  In Netscape
4.76, I get:

Testing Transform...

props:

-- listing properties --

doctype-public=-//W3C//DTD XHTML 1.0 Transitional//EN

{http\u003a//xml.apache.org/xslt}content-handler=org.apache.xalan.serialize.Serializer...

indent=yes

method=xml

encoding=iso-8859-1

standalone=no

version=1.0

media-type=text/xml

doctype-system=http://www.w3.org/TR/xhtml1/DTD/xhtml...

{http\u003a//xml.apache.org/xslt}indent-amount=0

omit-xml-declaration=no

org.apache.xml.utils.WrappedRuntimeException: The output format must
have a '{http://xml.apache.org/xslt}content-handler' property!

  at
org.apache.xalan.serialize.SerializerFactory.getSerializer(SerializerFactory.java:138)

  at
org.apache.xalan.transformer.TransformerImpl.createResultContentHandler(TransformerImpl.java:1063)

  at
org.apache.xalan.transformer.TransformerImpl.createResultContentHandler(TransformerImpl.java:1000)

* at
org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1115)

  at Applet1.init(Applet1.java:87)

  at
netscape.applet.DerivedAppletFrame$InitAppletEvent.dispatch(DerivedAppletFrame.java:553)

  at
java.awt.EventDispatchThread$EventPump.dispatchEvents(EventDispatchThread.java:81)

  at java.awt.EventDispatchThread.run(EventDispatchThread.java:135)

  at
netscape.applet.DerivedAppletFrame$AppletEventDispatchThread.run(DerivedAppletFrame.java:911)


-Edwin