Hi all.
 
    I'm new to FOP, XML, XSL, FO and so on. I'm getting an error message when i try to get a PDF from a XML and XSL source. The message i'm getting is the following:
    [INFO]: FOP 0.20.3
    [INFO]: building formatting object tree
    [INFO]: Parsing of document complete, stopping renderer
    [ERROR]: java.lang.ArithmeticException: / by zero
 
    As you could see, the error is for a division by 0 which means that when i'm going to see the *.pdf that FOP has created, it has no pages at all.
 
    If it is useful, i put here the command i use to execute FOP:
 
        C:\fop-0.20.3>fop -xsl c:\java\plantillaInformeFO-2.xsl -xml     c:\java\informe3.xml -pdf c:\java\informe.pdf

    I put also here the documents used to do the transformation:
 
plantillaInformeFO-2.xsl
 
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">

<xsl:template match="informe">

    <fo:root xmlns:fo="http://www.w3c.org/1999/XSL/Format">

        <fo:layout-master-set>

            <fo:simple-page-master master-name="all"

                page-height="11.5in" page-width="8.5in"

                margin="1in">

                <fo:region-body margin-top="1in" margin-bottom="0.75in"/>

                <fo:region-before extent="0.75in"/>

                <fo:region-after extent="0.5in"/>

            </fo:simple-page-master>

        </fo:layout-master-set>

        <fo:static-content flow-name="xsl-region-after">   

            <fo:block text-align="start" font-size="10pt" font-family="serif">

                Page(<fo:page-number/>)

            </fo:block>

        </fo:static-content>

        <fo:page-sequence master-reference="all">

            <fo:flow flow-name="xsl-region-body">

                <xsl:apply-templates select="comentari"/>

            </fo:flow>

        </fo:page-sequence>

    </fo:root>

    </xsl:template>

 

    <xsl:template match="comentari">

        <fo:block>

            <xsl:apply-templates select="titulo"/>

            <xsl:apply-templates select="autor"/>

            <xsl:apply-templates select="text"/>

        </fo:block>

    </xsl:template>

 

    <xsl:template match="titulo">

        <fo:block color="blue" font-family="sans-serif" font-size="20pt">

            <xsl:value-of select="."/>

        </fo:block>

    </xsl:template>

 

    <xsl:template match="autor">

        <fo:block font-style="italic" font-family="sans-serif" font-size="16pt">

            <xsl:value-of select="."/>

        </fo:block>

    </xsl:template>

 

    <xsl:template match="text">

        <fo:block font-family="sans-serif" font-size="12pt">

            <xsl:value-of select="."/>

        </fo:block>

    </xsl:template>

</xsl:stylesheet>


And here is informe3.xml

<?xml version="1.0" encoding="UTF-16"?>

<informe>

    <comentari>

        <titulo>El se˝or de los anillos</titulo>

        <autor>J.R.R. Tolkien</autor>

        <text>La companyia de l'anell ha de destruir l'anell ˙nic.</text>

    </comentari>

    <comentari>

        <titulo>OmertÓ</titulo>

        <autor>Mario Puzzo</autor>

        <text>Aquesta Ús l'˙ltima novela de l'autor.</text>

    </comentari>

    <comentari>

        <titulo>El caso de Charles Dexter Ward</titulo>

        <autor>H.P. Lovecraft</autor>

        <text>Terror i misteri en aquesta obra d'un dels mestres del suspens.</text>

    </comentari>

</informe>

Reply via email to