I'm still having problems with the code.  I tried the XSLTDemo and it
works fine for me, so there must be something wrong with my environment.

What is interesting about my environment is that if I create a
StreamResult from a StringWriter to pass to the transform method like
so:

StringWriter sw = new StringWriter();
StreamResult sr = new StreamResult(sr); 
transformer.transform(source,sr); 

I get the correct output from sw.toString(); 

but if I do 

DocumentResult result = new DocumentResult();
transformer.transform(source, result);
Document transformDoc = result.getDocument();

and print out the document using XMLWriter, I get something like:

<?xml version="1.0" encoding="UTF-8"?>

<xml:text>&lt;?xml version="1.0"?&gt;</xml:text>

Allen

On Fri, Apr 19, 2002 at 07:49:48PM +0100, James Strachan wrote:
> Hi Allen
> 
> Sorry for the delay getting back to you. Have you tried running the XSLT
> sample program in dom4j/src/samples/XSLTDemo.java. It works fine for me on
> dom4j 1.2, 1.3 and the latest build.
> 
> With the right classpath you can do
> 
> java XSLTDemo foo.xml bar.xsl
> 
> Or there's an Ant target to make it even easier.
> 
> [windows]
> 
> build demo-xslt
> 
> [unix]
> 
> ./build.sh demo-xslt
> 
> And if you get a bunch of output of the transformation, then you'll see that
> the Document is coming back from the DocumentResult.
> 
> If this doesn't work for you maybe there's something wierd going on in your
> environment? If you still get problems please mail some sample code to the
> list and we can help fix the problem.
> 
> James
> ----- Original Message -----
> From: "Allen Lau" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Cc: "Allen Lau" <[EMAIL PROTECTED]>
> Sent: Thursday, April 04, 2002 3:28 AM
> Subject: [dom4j-user] DocumentResult doesn't work with transformer.transform
> 
> 
> Hi, I'm having a problem following the cookbook's example of applying a
> 
> XSLT stylesheet to a dom4j Document. Whenever I try to do
> 
> transformer.transform(src,result) where result is a DocumentResult
> 
> object, I get a empty document from the getDocument() method in
> DocumentResult.
> 
> I have tried the code on dom4j 1.2 and 1.3. Am I doing something wrong?
> 
> Thanks,
> 
> Allen
> 
> 
> 
> _________________________________________________________
> Do You Yahoo!?
> Get your free @yahoo.com address at http://mail.yahoo.com

-- 
You are fairminded, just and loving.

Attachment: msg00749/pgp00000.pgp
Description: PGP signature

Reply via email to