- From: <melih@portistanbul.com>
- Date: Mon, 08 Dec 2003 02:21:01 -0800 (PST)
- To: www-xsl-fo@w3.org
Hi, lets say I have a sentence like "Leading the Web to Its Full Potential...". There is after the word "Full" a page break. Normally, the word "Potential" should appear at the second Page, but I have "tential..." or "ntial..." or something like that. The first letters do not appear. I have attached the main part of my xsl:fo file and the Java code. ************* ... <xsl:template match ="/docu"> <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"> <fo:layout-master-set> <fo:simple-page-master master-name="sample" page-height="29.7cm" page-width="21cm" margin-top="1cm" margin-bottom="1cm" margin-left="2cm" margin-right="2.5cm"> <fo:region-body margin-top="2.5cm" margin-bottom="2.5cm"/> <fo:region-before extent="13cm"/> <fo:region-after extent="1.8cm"/> </fo:simple-page-master> </fo:layout-master-set> <xsl:apply-templates select="/docu/sequence/generate"/> </fo:root> </xsl:template> <xsl:template match="generate"> <xsl:variable name="generate_address" select="@address"/> <fo:page-sequence master-reference="sample" initial-page-number="1"> <fo:static-content flow-name="xsl-region-before"> <fo:block font-size="48pt" font-family="Courier" color="rgb(180,180,180)" font-weight="bold" line-height="48pt" > <xsl:if test="$print='SAMPLE'"> <xsl:value-of select="SAMPLE"/> </xsl:if> </fo:block> </fo:static-content> <fo:static-content flow-name="xsl-region-after"> <fo:block text-align="end" font-size="10pt" font-family="serif" line-height="10pt" > Page <fo:page-number/> from <fo:page-number-citation ref-id="end{$generate_address}"/> ... </fo:block> </fo:static-content> <fo:flow flow-name="xsl-region-body"> <fo:table table-layout="fixed" space-after="1.2cm"> <fo:table-column column-width="9.3cm"/> <fo:table-column column-width="7cm"/> <fo:table-body border-width="0.2mm" border-style="{$debug_table_border_style}"> <fo:table-row height="2cm"> <fo:table-cell display-align="center" border-width="{$debug_table_border_width}" border-style="{$debug_table_border_style}"> </fo:table-cell> <fo:table-cell display-align="before" number-rows-spanned="2" border-width="{$debug_table_border_width}" border-style="{$debug_table_border_style}"> <xsl:apply-templates select="/docu/info/user"/> </fo:table-cell> </fo:table-row> <fo:table-row height="4.5cm"> <fo:table-cell display-align="before" border-width="{$debug_table_border_width}" border-style="{$debug_table_border_style}"> <xsl:apply-templates select="/docu/info/addresses/address[@id=$generate_address]"/> </fo:table-cell> </fo:table-row> </fo:table-body> </fo:table> <xsl:apply-templates select="/docu/textsequence/*"> <xsl:with-param name="variables" select="/docu/info/addresses/address[@id=$generate_address]/vardef"/> </xsl:apply-templates> <fo:block id="end{$generate_address}"> </fo:block> </fo:flow> </fo:page-sequence> </xsl:template> ... ************* the Java code which transforms it to a pdf file. ************* public static File createPDF(StringReader dataXML, StringReader xslt, String tempDir) throws PDFException, IOException { File pdfFile = null; if (tempDir != null){ pdfFile = File.createTempFile("mel", ".pdf", new File(tempDir)); pdfFile.deleteOnExit(); OutputStream theFileStream = new FileOutputStream(pdfFile); renderXML(dataXML, xslt, theFileStream); theFileStream.close(); } else { pdfFile = File.createTempFile("mel", ".pdf"); pdfFile.deleteOnExit(); OutputStream theFileStream = new FileOutputStream(pdfFile); renderXML(dataXML, xslt, theFileStream); theFileStream.close(); } return pdfFile; } private static void renderXML(StringReader dataXML, StringReader xslt, OutputStream out) throws PDFException { renderXML(new StreamSource(dataXML), new StreamSource(xslt), out); } private static void renderXML(StreamSource dataXML, StreamSource xslt, OutputStream out) throws PDFException { try { //ok. now transform it to Driver driver = new Driver(); driver.setLogger(log); driver.setRenderer(Driver.RENDER_PDF); driver.setOutputStream(out); SAXResult tempResult = new SAXResult(driver.getContentHandler()); TraxTransform.transform(dataXML, xslt, tempResult); } catch (Exception ex) { ex.printStackTrace(); throw new PDFException("Error!!!", ex); } } ************* Thanks in advance, Melih Vardar
Received on Monday, 8 December 2003 05:29:34 UTC