Problems concerning FOP: / by zero

Ali Sahin

Usenet Archive
Joined
Nov 18, 2005
Messages
3
Reaction score
0
Hi there,

I'd like to transform a XML-File to PDF.

The XML-File ist build like followed:

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <?xml-stylesheet type="text/xsl" href="D:\app\jboss-3.2.5\server\default\deploy\xifs.war\WEB-INF\classes\de\xifs\resource\xml\de\xifs\resource\xml\dunningaccountreport_de.xsl"?> <!DOCTYPE entities [ <!ENTITY iexcl "¡"> <!ENTITY cent "¢"> <!ENTITY pound "£"> <!ENTITY curren "¤"> <!ENTITY yen "¥"> <!ENTITY brvbar "¦"> <!ENTITY sect "§"> <!ENTITY uml "¨"> <!ENTITY copy "©"> <!ENTITY ordf "ª"> <!ENTITY laquo "«"> <!ENTITY not "¬"> <!ENTITY shy "­"> <!ENTITY reg "®"> <!ENTITY macr "¯"> <!ENTITY deg "°"> <!ENTITY plusmn "±"> <!ENTITY sup2 "²"> <!ENTITY sup3 "³"> <!ENTITY acute "´"> <!ENTITY micro "µ"> <!ENTITY para "¶"> <!ENTITY middot "·"> <!ENTITY cedil "¸"> <!ENTITY sup1 "¹"> <!ENTITY ordm "º"> <!ENTITY raquo "»"> <!ENTITY frac14 "¼"> <!ENTITY frac12 "½"> <!ENTITY frac34 "¾"> <!ENTITY iquest "¿"> <!ENTITY Agrave "À"> <!ENTITY Aacute "Á"> <!ENTITY Acirc "Â"> <!ENTITY Atilde "Ã"> <!ENTITY Auml "Ä"> <!ENTITY Aring "Å"> <!ENTITY AElig "Æ"> <!ENTITY Ccedil "Ç"> <!ENTITY Egrave "È"> <!ENTITY Eacute "É"> <!ENTITY Ecirc "Ê"> <!ENTITY Euml "Ë"> <!ENTITY Igrave "Ì"> <!ENTITY Iacute "Í"> <!ENTITY Icirc "Î"> <!ENTITY Iuml "Ï"> <!ENTITY ETH "Ð"> <!ENTITY Ntilde "Ñ"> <!ENTITY Ograve "Ò"> <!ENTITY Oacute "Ó"> <!ENTITY Ocirc "Ô"> <!ENTITY Otilde "Õ"> <!ENTITY Ouml "Ö"> <!ENTITY times "×"> <!ENTITY Oslash "Ø"> <!ENTITY Ugrave "Ù"> <!ENTITY Uacute "Ú"> <!ENTITY Ucirc "Û"> <!ENTITY Uuml "Ü"> <!ENTITY Yacute "Ý"> <!ENTITY THORN "Þ"> <!ENTITY szlig "ß"> <!ENTITY agrave "à"> <!ENTITY aacute "á"> <!ENTITY acirc "â"> <!ENTITY atilde "ã"> <!ENTITY auml "ä"> <!ENTITY aring "å"> <!ENTITY aelig "æ"> <!ENTITY ccedil "ç"> <!ENTITY egrave "è"> <!ENTITY eacute "é"> <!ENTITY ecirc "ê"> <!ENTITY euml "ë"> <!ENTITY igrave "ì"> <!ENTITY iacute "í"> <!ENTITY icirc "î"> <!ENTITY iuml "ï"> <!ENTITY eth "ð"> <!ENTITY ntilde "ñ"> <!ENTITY ograve "ò"> <!ENTITY oacute "ó"> <!ENTITY ocirc "ô"> <!ENTITY otilde "õ"> <!ENTITY ouml "ö"> <!ENTITY divide "÷"> <!ENTITY oslash "ø"> <!ENTITY ugrave "ù"> <!ENTITY uacute "ú"> <!ENTITY ucirc "û"> <!ENTITY uuml "ü"> <!ENTITY yacute "ý"> <!ENTITY thorn "þ"> <!ENTITY yuml "ÿ"> <!ENTITY quote """> <!ENTITY amp "&"> <!ENTITY lt "<"> <!ENTITY gt ">"> ]> <!-- AS-Lingo xmlns:IFS="www.as-lingo.de/" --> <data> <body> <page> <letter> <contact> <name> GETRAENKEVERTR. </name> <street> DANTESTR.1 </street> <city> 8000 MUENCHEN </city> </contact> <textpart> <contactperson> Bla Tel Kontakt </contactperson> <header> Kontoauszug </header> <maintext> Info bla bla </maintext> <column0> Belegnummer </column0> <column1> Mahnstufe </column1> <column2> Belegdatum </column2> <column3> F&auml;llig </column3> <column4> Buchungstext </column4> <column5> Soll/Haben </column5> </textpart> <voucher> <docnumber> 0000012 </docnumber> <dunninglevel> </dunninglevel> <docdate>
15.03.2001
</docdate>
<duedate>
15.03.2001
</duedate>
<doctext>
EINGANGSRECHNUNG - IFS-Bugr.: 00009
</doctext>
<amount>
42000,00
</amount>
<debitcredit>

</debitcredit>
</voucher>
<voucher>
<docnumber>
0000012
</docnumber>
<dunninglevel>
</dunninglevel>
<docdate>
15.03.2001
</docdate>
<duedate>
15.03.2001
</duedate>
<doctext>
EINGANGSRECHNUNG - IFS-Bugr.: 00009
</doctext>
<amount>
1100,00
</amount>
<debitcredit>

</debitcredit>
</voucher>
<voucher>
<docnumber>
0000012-001
</docnumber>
<dunninglevel>
</dunninglevel>
<docdate>
15.03.2001
</docdate>
<duedate>
15.03.2001
</duedate>
<doctext>
EINGANGSRECHNUNG - IFS-Bugr.: 00010
</doctext>
<amount>
42000,00
</amount>
<debitcredit>

</debitcredit>
</voucher>
<voucher>
<docnumber>
0000012-001
</docnumber>
<dunninglevel>
</dunninglevel>
<docdate>
15.03.2001
</docdate>
<duedate>
15.03.2001
</duedate>
<doctext>
EINGANGSRECHNUNG - IFS-Bugr.: 00010
</doctext>
<amount>
1100,00
</amount>
<debitcredit>

</debitcredit>
</voucher>
</letter>
</page>
</body>
</data>

The XSL-File:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:fo="http://www.w3.org/1999/XSL/Format"> <xsl:template match ="/"> <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"> <fo:layout-master-set> <fo:simple-page-master master-reference="standard" page-height="29.7cm" page-width="21cm" margin-top="1.5cm" margin-bottom="1.5cm" margin-left="2.5cm" margin-right="2.5cm"> <fo:region-before extent="2.0cm"/> <fo:region-after extent="0.3cm"/> <fo:region-body margin-top="2.0cm" margin-bottom="0.5cm"/> </fo:simple-page-master> </fo:layout-master-set> <xsl:for-each select="data/page/letter"> <fo:page-sequence master-name="standard" initial-page-number="1"> <fo:static-content flow-name="xsl-region-before"> <fo:table table-layout="fixed" padding="1pt"> <fo:table-column column-width="7.5cm"/> <fo:table-column column-width="9cm"/> <fo:table-header> </fo:table-header> <fo:table-body> <fo:table-row> <fo:table-cell> <fo:block text-align="left" font-size="7pt" font-family="Courier" line-height="10pt"

font-weight="bold">
<xsl:apply-templates select="name2"/><br></br>

<xsl:apply-templates select="street"/><br></br>

<xsl:apply-templates select="city"/><br></br>
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block text-align="left"
font-size="7pt"
font-family="Courier"
line-height="10pt"

font-weight="bold">

<xsl:apply-templates
select="../textpart/contactperson"/>
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
<fo:table table-layout="fixed"
padding="1pt">
<fo:table-column
column-width="16.5cm"/>
<fo:table-header>
<fo:table-row>
<fo:table-cell>
<fo:block
font-family="Courier" font-size="7pt" text-align="left">

<xsl:apply-templates select="../textpart/header"/>
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-header>
<fo:table-body>
</fo:table-body>
</fo:table>
<fo:table table-layout="fixed" padding="1pt">
<fo:table-column
column-width="2.75cm"/>
<fo:table-column column-width="2.75cm"/>
<fo:table-column
column-width="2.75cm"/>
<fo:table-column column-width="2.75cm"/>
<fo:table-column
column-width="2.75cm"/>
<fo:table-column column-width="2.75cm"/>
<fo:table-header>
<fo:table-row>
<fo:table-cell >
<fo:block font-family="Courier" font-size="7pt"
text-align="left">

<xsl:apply-templates select="../textpart/column1"/>
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block font-family="Courier" font-size="7pt"
text-align="left" > <!-- white-space-collapse="false">-->

<xsl:apply-templates select="../textpart/column2"/>
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block font-family="Courier" font-size="7pt"
text-align="left" > <!-- white-space-collapse="false">-->

<xsl:apply-templates select="../textpart/column3"/>
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block font-family="Courier" font-size="7pt"
text-align="left" > <!-- white-space-collapse="false">-->

<xsl:apply-templates select="../textpart/column4"/>
</fo:block>
</fo:table-cell>
<fo:table-cell >
<fo:block font-family="Courier" font-size="7pt"
text-align="left">

<xsl:apply-templates select="../textpart/column5"/>
</fo:block>
</fo:table-cell>
<fo:table-cell >
<fo:block font-family="Courier" font-size="7pt"
text-align="left" > <!-- white-space-collapse="false">-->

<xsl:apply-templates select="../textpart/column6"/>
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-header>
<fo:table-body>
</fo:table-body>
</fo:table>
</fo:static-content>
<fo:flow flow-name="xsl-region-body">
<xsl:apply-templates/>
</fo:flow>
</fo:page-sequence>
</xsl:for-each>
</fo:root>
</xsl:template>
</xsl:stylesheet>

When I fire up the transformation I get an error:

[INFO]
building formatting object tree
[INFO]
Parsing of document complete, stopping renderer
javax.xml.transform.TransformerException:
java.lang.ArithmeticException: / by zero
at
org.apache.xalan.transformer.TransformerImpl.transformNode(TransformerImpl.java:1276) at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:668) at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1129) at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1107) at de.xifs.worker.PrintDocumentWorker.render2PDF(PrintDocumentWorker.java:212)

What's the matter?

Greets
kirashet
 

Andrew Thompson

Usenet Archive
Joined
Jan 16, 2003
Messages
9,476
Reaction score
0
Ali Sahin wrote:
....
What's the matter?

You expect the folks here to claw over 400 lines of your poorly trimmed example to find the error?

The best way to get help is to trim back the example
to a point where it is the *shortest* practical
demonstration of the problem.

One way to trim this example would be to remove every.. <!ENTITY cent "¢"> ...but one. If you can get it to work (or fail) with one entity defined, you can then extend it to all of them.
 

Peter Flynn

Usenet Archive
Joined
Jan 2, 2000
Messages
1,813
Reaction score
0
Ali Sahin wrote:

[snip]
When I fire up the transformation I get an error:

[INFO]
building formatting object tree
[INFO]
Parsing of document complete, stopping renderer
javax.xml.transform.TransformerException:
java.lang.ArithmeticException: / by zero
at [snap]
What's the matter?
[snoodle]

It's written in Java, that's what. When a Java application hits an error it gives you a trace of the location in the Java code where the error occurred, instead of giving you the location in your document where it occurred, just to be obtuse. This is because Java programmers think it is far more likely that their code is at fault than your document :)

[Sorry, just being cranky. There are plenty of Java applications which behave sensibly, but also plenty that don't.]

///Peter
 

Harrie

Usenet Archive
Joined
Jan 18, 2002
Messages
51
Reaction score
0
Ali Sahin said the following on 11/18/2005 10:05 +0200:
I'd like to transform a XML-File to PDF.

That should be possible.
The XML-File ist build like followed:
[snip very long XML listing]
The XSL-File:
[snip long XSL file]
When I fire up the transformation I get an error:

Exactly how did you run it?
[INFO]
building formatting object tree
[INFO]
Parsing of document complete, stopping renderer
javax.xml.transform.TransformerException:
java.lang.ArithmeticException: / by zero
at
org.apache.xalan.transformer.TransformerImpl.transformNode(TransformerImpl.java:1276) at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:668) at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1129) at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1107) at de.xifs.worker.PrintDocumentWorker.render2PDF(PrintDocumentWorker.java:212)

What's the matter?

Andrew Thompson gave you very good advice to make a simple test case. I really recommend that if you expect people to help you.

However, I've copied your info into two files and processed them with xsltproc, which give an almost empty temporarily FO file, so I guess your XSL stylesheet has a problem. Maybe your FOP gives the devided by zero error because of this, I don't know, like Peter explained, java programs are not the most user friendly things to give you any hint on where the problem is.

I can advise you to do it in two steps (XML + XSL -> XSL-FO and XSL-FO
-> PDF) to debug your problem, at least untill you've solved your problem. That way you can examine the XSL-FO file and can edit it if you want.

When I run FOP directly or on the temp FO file, FOP finishes without error and produces an empty pdf file (empty as in no content, the pdf file is 403 bytes long), but GSview gives an error on opening it (sorry, I don't use Adobe Acrobat Reader), presumably because the pdf file doesn't contain data.

You might want to tell us exactly how you invoke FOP, so we can try tp reproduce your problem, but like Andrew said, I guess nobody is willing to wade through 400 lines of code.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
548,049
Messages
3,104,246
Members
248,133
Latest member
DujonT

Latest Threads

Top