473,756 Members | 5,660 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problems concerning FOP: / by zero

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\jb oss-3.2.5\server\de fault\deploy\xi fs.war\WEB-INF\classes\de\ xifs\resource\x ml\de\xifs\reso urce\xml\dunnin gaccountreport_ 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>
<contactperso n>
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>
EINGANGSRECHNUN G - 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>
EINGANGSRECHNUN G - 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>
EINGANGSRECHNUN G - 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>
EINGANGSRECHNUN G - IFS-Bugr.: 00010
</doctext>
<amount>
1100,00
</amount>
<debitcredit>

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

The XSL-File:

<xsl:styleshe et 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="stan dard"
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.trans form.Transforme rException:
java.lang.Arith meticException: / by zero
at
org.apache.xala n.transformer.T ransformerImpl. transformNode(T ransformerImpl. java:1276)
at
org.apache.xala n.transformer.T ransformerImpl. transform(Trans formerImpl.java :668)
at
org.apache.xala n.transformer.T ransformerImpl. transform(Trans formerImpl.java :1129)
at
org.apache.xala n.transformer.T ransformerImpl. transform(Trans formerImpl.java :1107)
at
de.xifs.worker. PrintDocumentWo rker.render2PDF (PrintDocumentW orker.java:212)
What's the matter?

Greets
kirashet

Nov 23 '05 #1
3 2399
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.

--
Andrew Thompson
physci, javasaver, 1point1c, lensescapes - athompson.info/andrew
Currently accepting short and long term Java contracts - on Earth.
Nov 23 '05 #2
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.trans form.Transforme rException:
java.lang.Arith meticException: / 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

Nov 23 '05 #3
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.trans form.Transforme rException:
java.lang.Arith meticException: / by zero
at
org.apache.xala n.transformer.T ransformerImpl. transformNode(T ransformerImpl. java:1276)
at
org.apache.xala n.transformer.T ransformerImpl. transform(Trans formerImpl.java :668)
at
org.apache.xala n.transformer.T ransformerImpl. transform(Trans formerImpl.java :1129)
at
org.apache.xala n.transformer.T ransformerImpl. transform(Trans formerImpl.java :1107)
at
de.xifs.worker. PrintDocumentWo rker.render2PDF (PrintDocumentW orker.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.

--
Regards
Harrie
Nov 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3281
by: dentaku | last post by:
I use Apache FOP to create PDF files out of XSL + XML input files. The XSL file can contain SVG-images via --- <fo:block> <fo:instream-foreign-object> <svg:svg width="70mm" height="52.5mm" xmlns:xlink="http://www.w3.org/2000/svg"> <svg:image width="70mm" height="52.5mm" xlink:href="{$chart_C_Test_S}"/>
0
1414
by: Andrew Tyson | last post by:
Hi, I am pulling my hair out trying to figure out a problem that I am having using FOP to generate PDFs that have embedded SVG graphics. The base 64 encoded SVG is embedded as an attribute within a source XML document <?xml version="1.0" encoding="UTF-8"?> <ReportCashAcctStmt portfolioCode="FIXED_1" portfolioRptName="Fixed Interest
1
1973
by: Johnny | last post by:
Hi together, I'm new to XML and have problems with FOP (http://www.apache.org/dyn/closer.cgi/xml/fop) When I try to convert my .fo document to .pdf, I get this message: fo:39:26 master-reference '' for fo:page-sequence matches no simple-page-master or page-sequence-master
1
2515
by: timodheere | last post by:
Hi all! I'm quite new to FOP and have spent the day on this Mac O 10.3.4 trying every possible installation combination I can think of but I must be missing something very very basic that none of the mai sites feel the need to mention, as the command line still spits bac nothing but -bash: fop: command not found Can anyone give me a hint as to what presumably obvious error I a making? Many thanks
1
2147
by: Ruchi Dayal | last post by:
Hi, I am using XSL-FO/FOP to generate PDF documents from XSLT. The resultant PDF can run into thousands of pages and this is where the whole problem is. FOP cannot handle such large outputs. Our initial solution was to manually feed limited records to FOP so that it wouldn't "bomb out". However, this is getting messier as the number of records themselves, increase. Due to previous architectural decisions, it is also not possible to
1
3108
by: Jens Mueller | last post by:
Hi there, this is a Java-XML Question, so I am not sure whether this is the right place, haven't found anything better .... I try to convert a Java object to XML via SAX and let the FOP Transformer convert that via XSLT to valid XSL-FO. So I define a SAXReader which fires the SAX Events for the Java Object. This works fine and the Transformation to PDF is ok. However, I have one object which contains an XHTML String and the tags
4
2139
by: lorna.mitchell | last post by:
I hope I'm not repeating a question or missing any good resources but I really can't figure out the best way to progress with my problem. We'd like to use apache fop to generate documents in both PDF and PCL format - our email system will only take PDF and the fax system only PCL, Apache FOP is spot on for this. However it is choking on whatever I feed it, I think because not all the tags have been implemented. Can anyone recommend me...
0
1207
by: oaksong | last post by:
I'm trying to use a batch file to call FOP using redirection. Apparently this is a no-no. Does anyone have a suggestion as to how I can get FOP to run using files that are not located in the FOP directory? The file locations have such a long directory structure that the only solution I have is redirection. ( indicates the rest of the directory structure)...
0
1566
by: dentaku | last post by:
After I upgraded from FOP 0.20.5 to FOP 0.95, suddenly all texts in the tables moved towards the top. With FOP 0.20.5, the text was centered in a table cell that the CAPITAL letters were vertically centered. With FOP 0.95 the text is centered in a table cell that the LOWER CASE letters are vertically centered, i.e. the whole text moved towards the top of the cell. I found a workaround by enclosing the text in <fo:inline...
0
10069
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9904
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9884
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9735
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7285
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5168
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5324
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3828
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2697
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.