I've made the test with: <xsl:output method='text' encoding='ISO-8859-1'/>
And it still is transforming wrong. Now instead of putting "presta????o" it's appearing "presta??o", i. e. one "?" for each accented character. What can be wrong? -----Original Message----- From: Carlos Barroso [mailto:[EMAIL PROTECTED]] Sent: terça-feira, 10 de Dezembro de 2002 10:17 To: [EMAIL PROTECTED] Subject: RE: [dom4j-user] Transforming/Encoding problem... Hy Fergus. Thank you very very much the help. I forgot that. It's working now. -----Original Message----- From: Fergus Gallagher [mailto:[EMAIL PROTECTED]] Sent: terça-feira, 10 de Dezembro de 2002 10:13 To: Carlos Barroso Cc: [EMAIL PROTECTED] Subject: Re: [dom4j-user] Transforming/Encoding problem... The encoding you specify is only for input, the output is utf8. You need to specify the output encoding explicitly: <xsl:output method='text' encoding='ISO-8859-1'/> On Tue, Dec 10, 2002 at 10:04:43AM -0000, Carlos Barroso wrote: > Hy there. > > ----------------------------------------------- > I have a XML document like: > ----------------------------------------------- > > <?xml version="1.0" encoding="ISO-8859-1"?> > > <EXTRACTO_DETALHADO> > ( ... ) > > ----------------------------------------------- > And I have a XSL stylesheet like: > ----------------------------------------------- > > <?xml version='1.0' encoding='ISO-8859-1'?> > > <xsl:stylesheet version='1.0' > xmlns:xsl='http://www.w3.org/1999/XSL/Transform'> > <xsl:output method='text'/> > > <xsl:template match='/EXTRACTO_DETALHADO'> > ( ... ) > > ----------------------------------------------- > My transformation class is like: > ----------------------------------------------- > > import javax.xml.transform.Transformer; > import javax.xml.transform.TransformerFactory; > import javax.xml.transform.stream.StreamSource; > import javax.xml.transform.stream.StreamResult; > import javax.xml.transform.TransformerConfigurationException; > import javax.xml.transform.TransformerException; > > import org.dom4j.Document; > import org.dom4j.io.DocumentSource; > import org.dom4j.io.SAXReader; > import org.dom4j.DocumentException; > > import java.io.File; > import java.io.StringReader; > import java.io.ByteArrayOutputStream; > > import org.xml.sax.InputSource; > > public class Teste { > public static void main(String[] args) { > > ByteArrayOutputStream result = new ByteArrayOutputStream(); > > try { > SAXReader reader = new SAXReader(); > Document document = reader.read(new File("/tmp/teste.xml")); > > TransformerFactory factory = TransformerFactory.newInstance(); > Transformer transformer = factory.newTransformer(new StreamSource(new > File("/tmp/extdet_txt.xsl"))); > > DocumentSource source = new DocumentSource(document); > transformer.transform(source, new StreamResult(result)); > > } catch(Exception e) { > System.out.println(e.getMessage()); > } > > System.out.println(result.toString()); > } > } > > > The problem is that words like "presta??o" are coming out "presta????o". > Words that have accents (?, ?, ?,...) are coming out bad. > I'm using encoding "ISO-8859-1". So what can be the problem!? > Can someplease help me. > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > dom4j-user mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/dom4j-user -- Fergus Gallagher Tel: +44 (20) 8742 1600 Orbis Fax: +44 (20) 8742 2649 414 Chiswick High Street email: [EMAIL PROTECTED] London W4 5TL Web: http://www.orbisuk.com ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ dom4j-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/dom4j-user ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ dom4j-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/dom4j-user