I am using the standard way shown on the fop embed example. My code is below.
The only thing I can think now is to get my java program to parse the doc and
put the decimal character symbol in myslef. Is there a better way using xsl
fo/xpath? cheers
OutputStream out = new BufferedOutputStream(new FileOutputStream(new
File("template.rtf")));
try {
// Step 3: Construct fop with desired output
format
//String s = "MimeConstants.MIME_RTF" ;
SAXBuilder builder = new SAXBuilder();
// Create the document
Document doc = builder.build(new
FileInputStream("template.xsl"));
Document doc2 = builder.build(new
FileInputStream("template.xml"));
XMLOutputter fmt3 = new XMLOutputter();
fmt3.output(doc2, System.out);
XMLOutputter fmt2 = new XMLOutputter();
fmt2.output(doc, System.out);
Fop fop = fopFactory.newFop("application/rtf", out);
// Step 4: Setup JAXP using identity
transformer
TransformerFactory factory = TransformerFactory.newInstance();
//Transformer transformer =
factory.newTransformer(); // identity transformer
Source xslt = new StreamSource(new File("template.xsl"));
Transformer transformer = factory.newTransformer(xslt);
// Step 5: Setup input and output for XSLT
transformation
// Setup input stream
Source src = new StreamSource(new File("template.xml"));
// Resulting SAX events (the generated FO)
must be piped through to FOP
Result res = new SAXResult(fop.getDefaultHandler());
// Step 6: Start XSLT transformation and FOP
processing
transformer.transform(src, res);
} finally {
//Clean-up
out.close();
}
-----Original Message-----
From: Chris Bowditch [mailto:[EMAIL PROTECTED]
Sent: 25 July 2006 16:01
To: [email protected]
Subject: Re: Information loss in embedded mode
Shamem Miah wrote:
> Hi
>
> I have a xsl template which uses list with symbols. When I generate
> an rtf document from the command prompt it outputs the document
> correctly with the correct symbols.
>
> Now when I perform the transformation in an embedded java program it
> the symbols are not displayed correctly. I noticed that they get
> changed from '▪' to '
>
> â-ª' . Anyone know how I can stop this.
Sounds like an encoding problem. How does your java application read the XSLT
and XML Files, and how does it pipe these files to FOP? Your are probably doing
an implicit conversion from bytes to String somewhere in your code.
Chris
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]