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 Sam Fuqua <sa...@gmail.com> on 2009/04/09 22:47:17 UTC

Fop Error with unknown element

Hi,

I'm getting a strange fop error that I can't figure out why I'm getting it.
The error is this:

ERROR:  'Error(Unknown location): fo:block is not a valid child
element of fo:table-row.'

My XSL is at the bottom.  The xml is aggregated from calls inside of a
for-loop, which transforms the xm into fo and appends the resulting fo
to an fo document that gets transformed into PDF at the end.  What I
am trying to do is pass a value called componentType, which gets
tested in the xsl.  If the value is STANDALONE_SUMMARY, then the
current xml generates a header and a table.  If it is SUMMARY, then it
creates a tablerow and the Java appends that to the table created in
STANDALONE_SUMMARY.  My problem is that there are no fo:blocks that
are outside of the table cells, so I don't understand why this
exception is being thrown.  Can anyone help me?  Just so you know, the
lone table-cells in my otherwise are appended to a table-row node that
is created in Java.

    <xsl:template match="ts:testscript">
	<fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format" space-after="10mm">
	<xsl:choose>
		<xsl:when test="/descendant::componentType='SUMMARY' or
/descendant::componentType='STANDALONE_SUMMARY'">
		<xsl:choose>
			<xsl:when test="/descendant::componentType='STANDALONE_SUMMARY'">
				<fo:block font-size="14pt" space-before="2mm"
space-after="2mm">Summary: Testscript</fo:block>
				<fo:table border="0.5pt solid black" text-align="center">
					<fo:table-header>
 						<fo:table-cell>
							<fo:block font-weight="bold">ID</fo:block>
						</fo:table-cell>
						<fo:table-cell>
							<fo:block font-weight="bold">Name</fo:block>
						</fo:table-cell>
						<fo:table-cell>
							<fo:block font-weight="bold">State</fo:block>
						</fo:table-cell>
						<fo:table-cell>
							<fo:block font-weight="bold">Type</fo:block>
						</fo:table-cell>
					</fo:table-header>
 					<fo:table-body>
 					<fo:table-row>
					<fo:table-cell padding="3pt" border="0.5pt solid black">
        			<fo:block font-size="10pt"> <xsl:number/> </fo:block>
      				</fo:table-cell>
					<fo:table-cell padding="6pt" border="0.5pt solid black">
        			<fo:block font-size="10pt"><xsl:value-of
select="ns3:title"/></fo:block>
      				</fo:table-cell>
      				<fo:table-cell padding="6pt" border="0.5pt solid black">
        			<fo:block font-size="10pt">
        			<xsl:choose>
        				<xsl:when
test="ns4:state='com.ibm.rqm.planning.common.underreview'">
        					Under Review
        				</xsl:when>
        				<xsl:when test="ns4:state='com.ibm.rqm.planning.common.new'">
        					Draft
        				</xsl:when>
        				<xsl:when test="ns4:state='com.ibm.rqm.planning.common.approved'">
        					Approved
        				</xsl:when>
        			</xsl:choose>
        			</fo:block>
      				</fo:table-cell>
      				<fo:table-cell padding="6pt" border="0.5pt solid black">
					<fo:block font-size="10pt"><xsl:value-of
select="ts:scripttype"/></fo:block>
					</fo:table-cell>
					</fo:table-row>
					</fo:table-body>
				</fo:table>
			</xsl:when>
			<xsl:otherwise>
					<fo:table-cell padding="3pt" border="0.5pt solid black">
        			<fo:block font-size="10pt"> <xsl:number/> </fo:block>
      				</fo:table-cell>
					<fo:table-cell padding="6pt" border="0.5pt solid black">
        			<fo:block font-size="10pt"><xsl:value-of
select="ns3:title"/></fo:block>
      				</fo:table-cell>
      				<fo:table-cell padding="6pt" border="0.5pt solid black">
        			<fo:block font-size="10pt">
        			<xsl:choose>
        				<xsl:when
test="ns4:state='com.ibm.rqm.planning.common.underreview'">
        					Under Review
        				</xsl:when>
        				<xsl:when test="ns4:state='com.ibm.rqm.planning.common.new'">
        					Draft
        				</xsl:when>
        				<xsl:when test="ns4:state='com.ibm.rqm.planning.common.approved'">
        					Approved
        				</xsl:when>
        			</xsl:choose>
        			</fo:block>
      				</fo:table-cell>
      				<fo:table-cell padding="6pt" border="0.5pt solid black">
					<fo:block font-size="10pt"><xsl:value-of
select="ts:scripttype"/></fo:block>
					</fo:table-cell>
			</xsl:otherwise>
			</xsl:choose>
		</xsl:when>
		<xsl:otherwise>
		<fo:marker marker-class-name="artifactUri">
			<fo:block font-size="8pt" color="black"><xsl:value-of
select="/descendant::originUrl"/></fo:block>
		</fo:marker>
		<fo:block keep-together.within-page=0>
		<fo:block font-size="14pt" space-before="2mm"
space-after="2mm">Testscript: <xsl:value-of
select="ns3:title"/></fo:block>
		<fo:block font-size="12pt" space-after="2mm">Type: <xsl:value-of
select="ts:scripttype"/></fo:block>
		<fo:block font-size="12pt" space-after="4mm">Description:
<xsl:value-of select="ns3:description"/></fo:block>
		<xsl:apply-templates select="ts:steps"/>
		</fo:block>
		</xsl:otherwise>
		</xsl:choose>
	</fo:block>
    </xsl:template>

--
Sam Fuqua
ΣΝ ΘΗ 454

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


Re: Fop Error with unknown element

Posted by Andreas Delmelle <an...@telenet.be>.
On 09 Apr 2009, at 22:47, Sam Fuqua wrote:

Hi Sam

> I'm getting a strange fop error that I can't figure out why I'm  
> getting it.
> The error is this:
>
> ERROR:  'Error(Unknown location): fo:block is not a valid child
> element of fo:table-row.'
>
> My XSL is at the bottom.

Well, the XSL itself will not really help you to track this down.

What you'll need to do is dump the resulting FO to disk somewhere, and  
then either run it through FOP using the command-line interface or  
open the file in an XML editor to search for it using XPath (//table- 
row[block]).
If you just re-run it from command-line, the error message above will  
point you to the actual location in the file. The downside is that  
there may be more of those after that, and you will have to repeat the  
procedure until all occurrences are eliminated. Using an XML editor,  
you can at least identify the whole set of offending nodes in one go.

Knowing where exactly those situations occur, should give you a clue  
on how to prevent it from happening.



HTH!


Andreas

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