Error: / by zero

Here should go questions about transforming XML with XSLT and FOP.
kirashet
Posts: 4
Joined: Fri Nov 18, 2005 11:37 am

Error: / by zero

Post by kirashet » Fri Nov 18, 2005 11:37 am

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

george
Site Admin
Posts: 2101
Joined: Thu Jan 09, 2003 2:58 pm

Post by george » Fri Nov 18, 2005 3:55 pm

Hi kirashet,

This works ok with Xalan 2.7.0 from oXygen.
The error you report looks like a bug in Xalan that you are using. And it is possible that you use the Xalan included with the Java disctribution, check the Xalan website for details about this, you have to use the endorsed mechanism to be sure you get the right version of Xalan used.

Best Regards,
George

Post Reply