You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Xavier Ottolini <xa...@adelis.com> on 2007/01/12 09:49:55 UTC

Mismatch: table-body

Hi,

I want to build a PDF file with a XSL transformation. I use FOP 0.93 on 
Tomcat 4.3 (Windows) . Fop is embeded in a JSP.

If I run FOP as a standalone application. The XSL transform is ran 
successfully. But In my embeded class, an exception is thrown :

ATTENTION: Mismatch: table-body (http://www.w3.org/1999/XSL/Format) vs. 
table (http://www.w3.org/1999/XSL/Format)
12 janv. 2007 09:34:09 org.apache.fop.fo.FOTreeBuilder$MainFOHandler 
endElement
ATTENTION: Mismatch: table-body (http://www.w3.org/1999/XSL/Format) vs. 
flow (http://www.w3.org/1999/XSL/Format)
12 janv. 2007 09:34:09 org.apache.fop.fo.FOTreeBuilder$MainFOHandler 
endElement
ATTENTION: Mismatch: table-body (http://www.w3.org/1999/XSL/Format) vs. 
page-sequence (http://www.w3.org/1999/XSL/Format)
12 janv. 2007 09:34:09 org.apache.fop.fo.FOTreeBuilder$MainFOHandler 
endElement
ATTENTION: Mismatch: table-body (http://www.w3.org/1999/XSL/Format) vs. 
root (http://www.w3.org/1999/XSL/Format)
javax.xml.transform.TransformerException: 
org.apache.fop.fo.ValidationException: Error(Unknown location): 
fo:table-body is missing child elements.
Required Content Model: marker* (table-row+|table-cell+)

The child element in the "table-body" tag is a "apply-template" element 
and not a "table-cell" element.

<fo:table-body>
<xsl:apply-templates select="detail/ligne"/>
</fo:table-body>

How to avoid this error message ?

Here is the XSLT file

<?xml version="1.0" encoding="ISO-8859-1" ?>
<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="/decompte">
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">

<fo:layout-master-set>
<fo:simple-page-master master-name="decomptes"
page-height="29.7cm"
page-width="21cm"
margin-top="2cm"
margin-bottom="1cm"
margin-left="2.5cm"
margin-right="2.5cm">
<fo:region-body margin-top="1cm" margin-bottom="2cm"/>
<fo:region-before region-name="header" extent="3cm"/>
<fo:region-after region-name="footer" extent="1.5cm"/>
</fo:simple-page-master>
</fo:layout-master-set>

<fo:page-sequence master-reference="decomptes">
<fo:static-content flow-name="footer">
<fo:block text-align="right">
Page
<fo:page-number />/<fo:page-number-citation ref-id="theEnd" />
</fo:block>
</fo:static-content>
<fo:static-content flow-name="header">
<fo:block-container height="7cm" width="100%" top="7cm" left="0cm" 
position="absolute">
<fo:block background-color="transparent">
<fo:external-graphic src="copie-conforme.svg" content-height="6.7cm" 
vertical-align="middle" />
</fo:block>
</fo:block-container>
</fo:static-content>
<fo:flow flow-name="xsl-region-body">

<fo:block space-after.optimum="5.5cm" />

<fo:table width="100%" table-layout="fixed" background-color="transparent">
<fo:table-column column-width="20%" />
<fo:table-column column-width="20%" />
<fo:table-column column-width="10%" />
<fo:table-column column-width="10%" />
<fo:table-column column-width="10%" />
<fo:table-column column-width="10%" />
<fo:table-column column-width="10%" />
<fo:table-column column-width="10%" />
<fo:table-header color="rgb(0,0,0)" font-weight="bold">
<fo:table-row>
<fo:table-cell padding="2pt" border="0.5pt solid black">
<fo:block font-size="8pt" 
text-align="center">B&#233;n&#233;ficiaire</fo:block>
</fo:table-cell>
<fo:table-cell padding="2pt" border="0.5pt solid black">
<fo:block font-size="8pt" text-align="center">Nature des soins</fo:block>
</fo:table-cell>
<fo:table-cell padding="2pt" border="0.5pt solid black">
<fo:block font-size="8pt" text-align="center">Date</fo:block>
</fo:table-cell>
<fo:table-cell padding="2pt" border="0.5pt solid black">
<fo:block font-size="8pt" text-align="center">D&#233;pense</fo:block>
</fo:table-cell>
<fo:table-cell padding="2pt" border="0.5pt solid black">
<fo:block font-size="8pt" text-align="center">Base de Rembt</fo:block>
</fo:table-cell>
<fo:table-cell padding="2pt" border="0.5pt solid black">
<fo:block font-size="8pt" text-align="center">Rembt CPAM</fo:block>
</fo:table-cell>
<fo:table-cell padding="2pt" border="0.5pt solid black">
<fo:block font-size="8pt" text-align="center">Rembt Mutuelle</fo:block>
</fo:table-cell>
<fo:table-cell padding="2pt" border="0.5pt solid black">
<fo:block font-size="8pt" text-align="center">Rembt Roederer</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-header>
<fo:table-body>
<xsl:apply-templates select="detail/ligne"/>
</fo:table-body>
</fo:table>
<fo:block id="theEnd" />
</fo:flow>
</fo:page-sequence>
</fo:root>
</xsl:template>



<xsl:template match="detail/ligne">
<fo:table-row>
<fo:table-cell padding="2pt" border="0.5pt solid black">
<fo:block font-size="8pt"><xsl:value-of select="ipnom"/></fo:block>
</fo:table-cell>
<fo:table-cell padding="2pt" border="0.5pt solid black">
<fo:block font-size="8pt"><xsl:value-of select="iacte"/></fo:block>
</fo:table-cell>
<fo:table-cell padding="2pt" border="0.5pt solid black">
<fo:block font-size="8pt"><xsl:value-of select="idsoin"/></fo:block>
</fo:table-cell>
<fo:table-cell padding="2pt" border="0.5pt solid black">
<fo:block font-size="8pt" text-align="right"><xsl:value-of 
select="idepen"/></fo:block>
</fo:table-cell>
<fo:table-cell padding="2pt" border="0.5pt solid black">
<fo:block font-size="8pt" text-align="right"><xsl:value-of 
select="itconv"/></fo:block>
</fo:table-cell>
<fo:table-cell padding="2pt" border="0.5pt solid black">
<fo:block font-size="8pt" text-align="right"><xsl:value-of 
select="ircpam"/></fo:block>
</fo:table-cell>
<fo:table-cell padding="2pt" border="0.5pt solid black">
<fo:block font-size="8pt" text-align="right"><xsl:value-of 
select="irmutu"/></fo:block>
</fo:table-cell>
<fo:table-cell padding="2pt" border="0.5pt solid black">
<fo:block font-size="8pt" text-align="right"><xsl:value-of 
select="irroed"/></fo:block>
</fo:table-cell>
</fo:table-row>
</xsl:template>
</xsl:stylesheet>

Regards,

Xavier

-- 
Pour préservez l’environnement n’imprimez cet e-mail qu’en cas de nécessité.

Xavier Ottolini
Développeur multimédia

Adelis
37 rue d'Engwiller
67350 La Walck
France
Téléphone : +33 (0) 3 69 20 29 02
Télécopie : +33 (0) 3 88 72 29 19
http://www.adelis.com



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


Re: Mismatch: table-body

Posted by Abel Braaksma <ab...@xs4all.nl>.
Xavier Ottolini wrote:
> Hi,
>
> I want to build a PDF file with a XSL transformation. I use FOP 0.93 
> on Tomcat 4.3 (Windows) . Fop is embeded in a JSP.
>
> If I run FOP as a standalone application. The XSL transform is ran 
> successfully. But In my embeded class, an exception is thrown :
>
> javax.xml.transform.TransformerException: 
> org.apache.fop.fo.ValidationException: Error(Unknown location): 
> fo:table-body is missing child elements.
> Required Content Model: marker* (table-row+|table-cell+)
>
> The child element in the "table-body" tag is a "apply-template" 
> element and not a "table-cell" element.
>
> <fo:table-body>
> <xsl:apply-templates select="detail/ligne"/>
> </fo:table-body>

No, the child of the element in the XSLT file is <xsl:apply-templates>. 
This is an XSLT instruction and it generates a result tree. If the 
context node has a child "detail" that has a child "ligne", these 
ligne-nodes will be processed by the matching template. If these nodes 
are not there, or there is no matching template, the fo:table-body will 
remain empty, which is illegal.

You can change the XSLT such that it does not include fo:table-body at 
all, or, better yet, not the whole table at all, depending on some 
condition.

Since this appears to be an XSLT question, you may be better off 
narrowing it down a bit and asking a specific question on the XSLT 
mailing list, instead of the FOP user list.

Cheers,
-- Abel Braaksma


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


Re: Mismatch: table-body

Posted by Xavier Ottolini <xa...@adelis.com>.
You were right, it was just an error in the XML document. Thanks.

Xavier Ottolini a écrit :
> Thanks you Abel.
>
> I'll check the DOM tree to see if some elements are missing.
> I'll also add a test before adding the table.
>
> Xavier
>
> Abel Braaksma a écrit :
>> Xavier Ottolini wrote:
>>> org.apache.fop.fo.ValidationException: Error(Unknown location): 
>>> fo:table-body is missing child elements.
>>> Required Content Model: marker* (table-row+|table-cell+)
>>
>> PS: your templates shows that you do have a matching template, 
>> containing well enough literal result elements. So, the place to look 
>> is the source XML. Consider running the XSLT stand-alone on your 
>> input document (the same input you use in your embedded class) and 
>> examine the xsl-fo output closely. Then, adjust the XSLT and/or the 
>> input XML according your required output (in this case: a table with 
>> content, or no table at all).
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
>> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>>
>

-- 
Pour préservez l’environnement n’imprimez cet e-mail qu’en cas de nécessité.

Xavier Ottolini
Développeur multimédia

Adelis
37 rue d'Engwiller
67350 La Walck
France
Téléphone : +33 (0) 3 69 20 29 02
Télécopie : +33 (0) 3 88 72 29 19
http://www.adelis.com



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


Re: Mismatch: table-body

Posted by Xavier Ottolini <xa...@adelis.com>.
Thanks you Abel.

I'll check the DOM tree to see if some elements are missing.
I'll also add a test before adding the table.

Xavier

Abel Braaksma a écrit :
> Xavier Ottolini wrote:
>> org.apache.fop.fo.ValidationException: Error(Unknown location): 
>> fo:table-body is missing child elements.
>> Required Content Model: marker* (table-row+|table-cell+)
>
> PS: your templates shows that you do have a matching template, 
> containing well enough literal result elements. So, the place to look 
> is the source XML. Consider running the XSLT stand-alone on your input 
> document (the same input you use in your embedded class) and examine 
> the xsl-fo output closely. Then, adjust the XSLT and/or the input XML 
> according your required output (in this case: a table with content, or 
> no table at all).
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>

-- 
Pour préservez l’environnement n’imprimez cet e-mail qu’en cas de nécessité.

Xavier Ottolini
Développeur multimédia

Adelis
37 rue d'Engwiller
67350 La Walck
France
Téléphone : +33 (0) 3 69 20 29 02
Télécopie : +33 (0) 3 88 72 29 19
http://www.adelis.com



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


Re: Mismatch: table-body

Posted by Abel Braaksma <ab...@xs4all.nl>.
Xavier Ottolini wrote:
> org.apache.fop.fo.ValidationException: Error(Unknown location): 
> fo:table-body is missing child elements.
> Required Content Model: marker* (table-row+|table-cell+)

PS: your templates shows that you do have a matching template, 
containing well enough literal result elements. So, the place to look is 
the source XML. Consider running the XSLT stand-alone on your input 
document (the same input you use in your embedded class) and examine the 
xsl-fo output closely. Then, adjust the XSLT and/or the input XML 
according your required output (in this case: a table with content, or 
no table at all).



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