xmlgraphics-fop-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nopalin <ivan.pera...@gmail.com>
Subject Same XSL-FO, with one xml it works fine, but with similar xml with less info it fails
Date Thu, 10 Jul 2008 17:25:11 GMT

Hi, i am using apache fop for almost 2 years and i encountered it a great
tool. i am using the compiled version: Build-Id: 20070818-190950-GMT+01:00
(vincent [Linux 2.6.20-16-generic i386, Java 1.4.2_14-b05]) and everything
works fine.

But recently, i made a report who has the next xsl-fo:

<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="1.1"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
        xmlns:fo="http://www.w3.org/1999/XSL/Format"
        exclude-result-prefixes="fo">
    <xsl:output method="xml" version="1.0"
            omit-xml-declaration="no" indent="yes"/>
   
    <xsl:template match="xmlreport">
        <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
           
            <fo:layout-master-set>
               
                <fo:simple-page-master master-name="letter"
                        page-height="21.59cm" page-width="27.84cm"
                        margin-top="1.2cm" margin-bottom="1.2cm"
                        margin-left="1.2cm" margin-right="1.2cm">
                    <fo:region-body/>
                </fo:simple-page-master>
           
            </fo:layout-master-set>
           
            <fo:page-sequence master-reference="letter">
               
                <fo:flow flow-name="xsl-region-body">
                    <fo:block font-size="8pt">
                       
                        <xsl:apply-templates select="pWeeks"/>
                   
                    </fo:block>
                </fo:flow>
            </fo:page-sequence>
        </fo:root>
   
    </xsl:template>
   
    <xsl:template match="pWeeks">
       
        <fo:block>
            <xsl:if test="position() > 1">
                <xsl:attribute name="break-before">page</xsl:attribute>
            </xsl:if>
            <fo:table>
                <fo:table-column column-width="60pt"/>
                <fo:table-column/>
                <fo:table-body>
                    <fo:table-row>
                       
                        <fo:table-cell>
                            <fo:block>
                                <!-- png requires Jimi library -->
                                <fo:external-graphic
                                        src="xsl/logo-60x60.png"/>
                            </fo:block>
                        </fo:table-cell>
         
                        <fo:table-cell display-align="center"
text-align="center">
                           
                            <fo:block font-size="2.4em"
                                    font-style="italic"
                                    font-weight="bold">
                               Company
                            </fo:block>
                           
                            <fo:block font-size="1.8em"
                                    font-weight="bold">
                                Area
                            </fo:block>
                       
                        </fo:table-cell>
                   
                    </fo:table-row>
                </fo:table-body>
            </fo:table>
           
            <fo:block font-weight="bold" padding-top="1em"
padding-bottom="0.5em" font-size="1.8em">
            Pronóstico a 53 Semanas
            </fo:block>
           
            <fo:table padding-top="2em">
                <fo:table-column column-width="4em"/>
                <fo:table-column column-width="20em"/>
                <fo:table-body>
               
                    <xsl:if test="byDay = 'true'">
                        <fo:table-row>                       
                            <fo:table-cell number-columns-spanned="2">
                                <fo:block font-weight="bold"
font-size="1.4em"> Detallado a Días </fo:block>
                            </fo:table-cell>                                       
                        </fo:table-row>
                       
                        <fo:table-row>                       
                            <fo:table-cell>
                                <fo:block font-weight="bold"> Desde
</fo:block>
                            </fo:table-cell>
                           
                            <fo:table-cell>
                                <fo:block> <xsl:value-of select="fromDate"/>
</fo:block>
                            </fo:table-cell>
                        </fo:table-row>
                       
                        <fo:table-row>                       
                            <fo:table-cell>
                                <fo:block font-weight="bold"> Hasta
</fo:block>
                            </fo:table-cell>
                           
                            <fo:table-cell>
                                <fo:block> <xsl:value-of select="toDate"/>
</fo:block>
                            </fo:table-cell>
                        </fo:table-row>
                    </xsl:if>
       
                    <xsl:if test="byDay = 'false'">
                        <fo:table-row>                       
                            <fo:table-cell>
                                <fo:block font-weight="bold"> Fecha
</fo:block>
                            </fo:table-cell>
                           
                            <fo:table-cell>
                                <fo:block> <xsl:value-of
select="generateDate"/> </fo:block>
                            </fo:table-cell>                   
                        </fo:table-row>
                    </xsl:if>
                </fo:table-body>
            </fo:table>
           
            <xsl:apply-templates select="tasks/task"/>
           
        </fo:block>
    </xsl:template>
 
      <xsl:template match="task">
     
          <fo:block padding-top="1em">
              <fo:table padding-top="1em">
                <fo:table-column column-width="9em"/>
                <fo:table-column/>
                <fo:table-body>       
               
                    <fo:table-row>                       
                        <fo:table-cell>
                            <fo:block font-weight="bold"> <xsl:value-of
select="equipName"/> </fo:block>
                        </fo:table-cell>
                       
                        <fo:table-cell>
                            <fo:block> <xsl:value-of
select="equipDescription"/> </fo:block>
                        </fo:table-cell>                   
                    </fo:table-row>
                   
                    <fo:table-row>                       
                        <fo:table-cell>
                            <fo:block> Ubicación </fo:block>
                        </fo:table-cell>
                       
                        <fo:table-cell>
                            <fo:block> <xsl:value-of
select="equipLocation"/> </fo:block>
                        </fo:table-cell>                   
                    </fo:table-row>
                   
                    <fo:table-row>                       
                        <fo:table-cell>
                            <fo:block> Descripción </fo:block>
                        </fo:table-cell>
                       
                        <fo:table-cell>
                            <fo:block> <xsl:value-of select="description"/>
</fo:block>
                        </fo:table-cell>                   
                    </fo:table-row>
                   
                    <fo:table-row>                       
                        <fo:table-cell>
                            <fo:block> Próxima Emisión </fo:block>
                        </fo:table-cell>
                       
                        <fo:table-cell>
                            <fo:block> <xsl:value-of
select="concat(emission, ' - (', emissionBefore, ' / ', emissionAfter,
')')"/> </fo:block>
                        </fo:table-cell>                   
                    </fo:table-row>                                   
               
                    <fo:table-row>                       
                        <fo:table-cell>
                            <fo:block> OTs vencidas </fo:block>
                        </fo:table-cell>
                       
                        <fo:table-cell>
                            <fo:block> <xsl:value-of select="expiredwos"/>
</fo:block>
                        </fo:table-cell>                   
                    </fo:table-row>
                   
                </fo:table-body>
            </fo:table>
        </fo:block>
       
        <fo:block padding-top="1em">
            <fo:table table-layout="fixed">           
                <xsl:for-each select="weeks/week">
                    <fo:table-column/>
                </xsl:for-each>
               
                <fo:table-header>
                    <fo:table-row
                        font-weight="bold" background-color="#F0F0F0">
                        <xsl:for-each select="weeks/week">                       
                            <fo:table-cell>
                                <fo:block text-align="center">
                                    <xsl:value-of select="name"/>
                                </fo:block>
                            </fo:table-cell>                       
                        </xsl:for-each>
                    </fo:table-row>
                </fo:table-header>
               
                <fo:table-body>
                    <fo:table-row >
                        <xsl:for-each select="weeks/week">
                            <fo:table-cell>
                                <fo:block text-align="center">
                                        <xsl:value-of select="value"/>
                                </fo:block>
                            </fo:table-cell>                       
                        </xsl:for-each>
                    </fo:table-row>
                </fo:table-body>
               
            </fo:table>
        </fo:block>     
      </xsl:template>   
</xsl:stylesheet>

with this XML the report works fine!
<pWeeks>
    <byDay>false</byDay>
    <generateDate>jul 9, 08</generateDate>
    <fromDate>jun 1, 08</fromDate>
    <toDate>jun 30, 08</toDate>
   
    <tasks>
        <task>
            <equipName>09WD</equipName>
            <equipDescription>SISTEMA DE AGUA CONTRA
INCENDI</equipDescription>
            <equipLocation></equipLocation>
            <emission>ene 4, 08</emission>
            <emissionBefore>dic 29, 07</emissionBefore>
            <emissionAfter>ene 10, 08</emissionAfter>
            <name></name>
            <description>REALIZAR MANTENIMIENTO MAYOR A LAS BOMBAS DEL
SISTEMA VS. INCENDIO SIGUIENDO EL PROCEDIMIENTO M4 ANEXO.</description>
            <expiredwos>78666</expiredwos>
           
            <weeks>
                <week>
                <name>1</name>
                <value>X</value>
                </week>
               
                <week>
                <name>2</name>
                <value></value>
                </week>
               
                <week>
                <name>3</name>
                <value></value>
                </week>
               
                <week>
                <name>4</name>
                <value></value>
                </week>
                <week>
                <name>5</name>
                <value></value>
                </week>
               
                <week>
                <name>6</name>
                <value></value>
                </week>
               
                <week>
                <name>7</name>
                <value></value>
                </week>
               
                <week>
                <name>8</name>
                <value></value>
                </week>
               
                <week>
                <name>9</name>
                <value></value>
                </week>
               
                <week>
                <name>10</name>
                <value></value>
                </week>
               
                <week>
                <name>11</name>
                <value></value>
                </week>
               
                <week>
                <name>12</name>
                <value></value>
                </week>
               
                <week>
                <name>13</name>
                <value></value>
                </week>
               
                <week>
                <name>14</name>
                <value></value>
                </week>
               
                <week>
                <name>15</name>
                <value></value>
                </week>
               
                <week>
                <name>16</name>
                <value></value>
                </week>
               
                <week>
                <name>17</name>
                <value></value>
                </week>
               
                <week>
                <name>18</name>
                <value></value>
                </week>
               
                <week>
                <name>19</name>
                <value></value>
                </week>
               
                <week>
                <name>20</name>
                <value></value>
                </week>
               
                <week>
                <name>21</name>
                <value></value>
                </week>
               
                <week>
                <name>22</name>
                <value></value>
                </week>
               
                <week>
                <name>23</name>
                <value></value>
                </week>
               
                <week>
                <name>24</name>
                <value></value>
                </week>
               
                <week>
                <name>25</name>
                <value>X</value>
                </week>
               
                <week>
                <name>26</name>
                <value></value>
                </week>
               
                <week>
                <name>27</name>
                <value></value>
                </week>
               
                <week>
                <name>28</name>
                <value></value>
                </week>
               
                <week>
                <name>29</name>
                <value></value>
                </week>
               
                <week>
                <name>30</name>
                <value></value>
                </week>
               
                <week>
                <name>31</name>
                <value></value>
                </week>
               
                <week>
                <name>32</name>
                <value></value>
                </week>
               
                <week>
                <name>33</name>
                <value></value>
                </week>
               
                <week>
                <name>34</name>
                <value></value>
                </week>
               
                <week>
                <name>35</name>
                <value></value>
                </week>
               
                <week>
                <name>36</name>
                <value></value>
                </week>
               
                <week>
                <name>37</name>
                <value></value>
                </week>
               
                <week>
                <name>38</name>
                <value></value>
                </week>
               
                <week>
                <name>39</name>
                <value></value>
                </week>
               
               
                <week>
                <name>40</name>
                <value></value>
                </week>
               
                <week>
                <name>41</name>
                <value></value>
                </week>
               
                <week>
                <name>42</name>
                <value></value>
                </week>
               
                <week>
                <name>43</name>
                <value></value>
                </week>
               
                <week>
                <name>44</name>
                <value></value>
                </week>
               
                <week>
                <name>45</name>
                <value></value>
                </week>
               
                <week>
                <name>46</name>
                <value></value>
                </week>
               
                <week>
                <name>47</name>
                <value></value>
                </week>
               
                <week>
                <name>48</name>
                <value></value>
                </week>
               
                <week>
                <name>49</name>
                <value>X</value>
                </week>
               
                <week>
                <name>50</name>
                <value></value>
                </week>
               
                <week>
                <name>51</name>
                <value></value>
                </week>
               
                <week>
                <name>52</name>
                <value></value>
                </week>
               
            </weeks>
        </task>
    </tasks>
</pWeeks>


but with the next one: it generates an excepcion:
<pWeeks>
    <byDay>true</byDay>
    <generateDate>jul 9, 08</generateDate>
    <fromDate>jun 1, 08</fromDate>
    <toDate>jun 30, 08</toDate>
    <tasks>
        <task>
            <equipName>09WD</equipName>
            <equipDescription>SISTEMA DE AGUA CONTRA
INCENDI</equipDescription>
            <equipLocation></equipLocation>
            <emission>ene 4, 08</emission>
            <emissionBefore>dic 29, 07</emissionBefore>
            <emissionAfter>ene 10, 08</emissionAfter>
            <name></name>
            <description>REALIZAR MANTENIMIENTO MAYOR A LAS BOMBAS DEL
SISTEMA VS. INCENDIO SIGUIENDO EL PROCEDIMIENTO M4 ANEXO.</description>
            <expiredwos>78666</expiredwos>
           
            <weeks>
                <week>
                <name>1</name>
                <value></value>
                </week>
               
                <week>
                <name>2</name>
                <value></value>
                </week>
               
                <week>
                <name>3</name>
                <value></value>
                </week>
               
                <week>
                <name>4</name>
                <value></value>
                </week>
               
                <week>
                <name>5</name>
                <value></value>
                </week>
               
                <week>
                <name>6</name>
                <value></value>
                </week>
               
                <week>
                <name>7</name>
                <value></value>
                </week>
               
                <week>
                <name>8</name>
                <value></value>
                </week>
               
                <week>
                <name>9</name>
                <value></value>
                </week>
               
                <week>
                <name>10</name>
                <value></value>
                </week>
               
                <week>
                <name>11</name>
                <value></value>
                </week>
               
                <week>
                <name>12</name>
                <value></value>
                </week>
               
                <week>
                <name>13</name>
                <value></value>
                </week>
               
                <week>
                <name>14</name>
                <value></value>
                </week>
               
                <week>
                <name>15</name>
                <value></value>
                </week>
               
                <week>
                <name>16</name>
                <value></value>
                </week>
               
                <week>
                <name>17</name>
                <value></value>
                </week>
               
                <week>
                <name>18</name>
                <value></value>
                </week>
               
                <week>
                <name>19</name>
                <value></value>
                </week>
               
                <week>
                <name>20</name>
                <value></value>
                </week>
               
                <week>
                <name>21</name>
                <value></value>
                </week>
               
                <week>
                <name>22</name>
                <value></value>
                </week>
               
                <week>
                <name>23</name>
                <value></value>
                </week>
               
                <week>
                <name>24</name>
                <value></value>
                </week>
               
                <week>
                <name>25</name>
                <value></value>
                </week>
               
                <week>
                <name>26</name>
                <value></value>
                </week>
               
                <week>
                <name>27</name>
                <value></value>
                </week>
               
                <week>
                <name>28</name>
                <value></value>
                </week>
               
                <week>
                <name>29</name>
                <value></value>
                </week>
               
                <week>
                <name>30</name>
                <value></value>
                </week>
               
            </weeks>
        </task>
    </tasks>
</pWeeks>

Excepción: (this is all stack trace)
12:44:47,234 ERROR AWT-EventQueue-0:FOTreeBuilder -
javax.xml.transform.TransformerException: java.lang.NullPointerException
SystemId desconocido; Línea núm.0; Columna núm.0;
java.lang.NullPointerException

i am getting crazy because it has no logic, if the value is empyt or a space
it fails. But when i put any character it works fine.
What i do for now is put an underline, but i'd like to know why it is
throwing that exception...


grettings
-- 
View this message in context: http://www.nabble.com/Same-XSL-FO%2C-with-one-xml-it-works-fine%2C-but-with-similar-xml-with-less-info-it-fails-tp18387906p18387906.html
Sent from the FOP - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Mime
View raw message