On Fri, 26 Oct 2001, [ks_c_5601-1987] ±Έ ΕΒΘΈ wrote:
> I have ever experienced with yours. At that time I used xerces parser > version 1.3.1 and xalan 2.2. After I changed xerces for 1.4.2, the bug > is disappeared without changing java code. > > Try xerces parser 1.4.2 and xalan 2.2, the bug would be disappeared. I switched to xerces parser 1.4.3 and xalan 2.2 but the problem remains :-( Thank you for your help friend, Dionysis > -----Original Message----- > From: Dionysios G. Synodinos [mailto:[EMAIL PROTECTED] > Sent: Thursday, October 25, 2001 11:56 PM > To: [EMAIL PROTECTED] > Subject: Xalan and FOP for non-English XML (iso-8859-7) > > > I'm trying to use xalan-j_2_2_D11 to transform an XML document, which > holds text in the Greek language (ISO-8859-7), both to HTML and PDF > (Fop-0.20.1). > > > When I run the code for HTML, the Greek characters are escaped to > strings > beginning with ampersand, which is handled fine by the IE 6 on my PC, > but > of course it's not possible to edit the HTML code afterwards by had. > > When I run the code for PDF, the fo file produced doesn't display the > Greek characters correctly when opened with a simple text editor, and > the > PDF produced by it is still doesn't display Greek. > > What am I doing wrong? > > foo.xml code > ------------ > <?xml version="1.0" encoding="ISO-8859-7"?> > <foo> > <txt> > GREEK_TEXT > </txt> > </foo> > > foo-html.xsl > ------------ > <?xml version="1.0" encoding="ISO-8859-7"?> > <xsl:stylesheet version="1.0" > xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> > <xsl:output encoding="ISO-8859-7"/> > <xsl:template match="/"> > <html><head><title>foo page</title></head><body><table> > <xsl:apply-templates/> > </table></body></html> > </xsl:template> > <xsl:template match="txt"> > <tr><td><h1><xsl:apply-templates/></h1></td></tr> > </xsl:template> > </xsl:stylesheet> > > foo-fo.xsl > ---------- > <?xml version="1.0"?> > <xsl:stylesheet version="1.0" > xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > xmlns:fo="http://www.w3.org/1999/XSL/Format"> > <xsl:output encoding="ISO-8859-7"/> > <xsl:template match="/"> > <xsl:apply-templates select="foo"/> > </xsl:template> > <xsl:template match="foo"> > <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"> > <fo:layout-master-set> > <fo:simple-page-master > page-master-name="main" > margin-top="75pt" > margin-bottom="75pt" > margin-left="75pt" > margin-right="75pt"> > <fo:region-body margin-bottom="75pt"/> > </fo:simple-page-master> > </fo:layout-master-set> > <fo:page-sequence> > <fo:sequence-specification> > <fo:sequence-specifier-alternating > page-master-first="main" > page-master-odd="main" > page-master-even="main"/> > </fo:sequence-specification> > <fo:flow> > <xsl:apply-templates select="txt"/> > </fo:flow> > </fo:page-sequence> > </fo:root> > </xsl:template> > <xsl:template match="txt"> > <fo:block > font-size="24pt" line-height="27pt" > text-align-last="start" > space-before.optimum="24pt"> > <xsl:apply-templates/> > </fo:block> > </xsl:template> > </xsl:stylesheet> > > Java code for XML->HTML (foo.xml + foo-html.xsl) > ------------------------------------------------ > tFactory = TransformerFactory.newInstance(); > transformer = tFactory.newTransformer(new StreamSource(foo-html.xsl)); > transformer.transform(new StreamSource(foo.xml), new StreamResult(new > FileOutputStream(foo.html))); > > Java code for XML->PDF (foo.xml + foo-pdf.xsl) > ------------------------------------------------ > // First produce and serialize foo.fo > tFactory = TransformerFactory.newInstance(); > transformer = tFactory.newTransformer(new StreamSource(foo-pdf.xsl)); > transformer.transform(new StreamSource(foo.xml), new StreamResult(new > FileOutputStream(foo.fo))); > // foo.fo serialized > (public static final int RENDER_PDF = 1;) > InputSource fopfile = new InputSource("foo.fo"); > String version = org.apache.fop.apps.Version.getVersion() ; > System.setProperty("org.xml.sax.driver","org.apache.xerces.parsers.SAXPa > rser"); > XMLReader parser = null; > parser = XMLReaderFactory.createXMLReader(); > Driver driver = new Driver( > new InputSource ("$PATH/foo.fo"), > new FileOutputStream("$PATH/foo.pdf")); > driver.setRenderer(RENDER_PDF); > driver.run(); > > > > > _______________________________________________________________________ Dionysios G. Synodinos Network Management Center @ NTUA.gr http://synodinos.net http://noc.ntua.gr
