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 Mike Chambers <mi...@watchfront.co.uk> on 2011/10/06 15:30:00 UTC

Problem with fo:external-graphic element in processing output from either Saxon or Xalan

Hi,

I am getting this runtime error:
org.apache.fop.fo.ValidationException:
file:/home/mike/source/docbook/sample_doc2_xalan.fo:1:66363: Error(1/66363):
fo:external-graphic is not a valid child element of fo:flow.

after I added      <imagedata fileref="Screenshot1.png"/>
to a very simple DocBook XML sourcefile 

I am new to DocBook, XSLT, XSL-FO etc. but looking at the XSL 1.0 specification
at http://www.w3.org/TR/2001/REC-xsl-20011015/ i see "fo:flow formatting object
is a sequence of flow objects" and "The fo:external-graphic flow object is used
for a graphic where the graphics data resides outside of the XML result tree in
the fo namespace.", implying fo:external-graphic /is/ a valid child element of
fo:flow ?

I am running FOP on a Ubuntu 10.04 Linux box, using the 'fop' package from the
Ubuntu repositories.

Maybe it is a Ubuntu package bug, so if anyone can point me at what I should
look at to work out whether this is the case, or indeed suggest any other reason
for this run-time error I would appreciate it.

OOI, without the <imagedata/> element in the DocBook source, FOP runs OK and
generates a usable PDF.

It looks like I have FOP v0.95, judging from the content of the /usr/share/java
directory.

Thanks,
Mike


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


Re: Problem with fo:external-graphic element in processing output from either Saxon or Xalan

Posted by Glenn Adams <gl...@skynav.com>.
supply an FO (not XLST)  input file if you wish to have your input examined;
make sure to supply all referenced resources

On Thu, Oct 6, 2011 at 9:30 PM, Mike Chambers <mi...@watchfront.co.uk> wrote:

> Hi,
>
> I am getting this runtime error:
> org.apache.fop.fo.ValidationException:
> file:/home/mike/source/docbook/sample_doc2_xalan.fo:1:66363:
> Error(1/66363):
> fo:external-graphic is not a valid child element of fo:flow.
>
> after I added      <imagedata fileref="Screenshot1.png"/>
> to a very simple DocBook XML sourcefile
>
> I am new to DocBook, XSLT, XSL-FO etc. but looking at the XSL 1.0
> specification
> at http://www.w3.org/TR/2001/REC-xsl-20011015/ i see "fo:flow formatting
> object
> is a sequence of flow objects" and "The fo:external-graphic flow object is
> used
> for a graphic where the graphics data resides outside of the XML result
> tree in
> the fo namespace.", implying fo:external-graphic /is/ a valid child element
> of
> fo:flow ?
>
> I am running FOP on a Ubuntu 10.04 Linux box, using the 'fop' package from
> the
> Ubuntu repositories.
>
> Maybe it is a Ubuntu package bug, so if anyone can point me at what I
> should
> look at to work out whether this is the case, or indeed suggest any other
> reason
> for this run-time error I would appreciate it.
>
> OOI, without the <imagedata/> element in the DocBook source, FOP runs OK
> and
> generates a usable PDF.
>
> It looks like I have FOP v0.95, judging from the content of the
> /usr/share/java
> directory.
>
> Thanks,
> Mike
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>
>

Re: Problem with fo:external-graphic element in processing output from either Saxon or Xalan

Posted by mehdi houshmand <me...@gmail.com>.
No problem. Just remember when you're using XSLT that there's an extra
step in creating the FO:

XSLT + XML --> FO --> FOP --> document output (in your case this is PDF)

If you're debugging for any reason, it's usually easiest to use an XSL
transformer to create the FO and debug these processes separately.

Mehdi

On 7 October 2011 11:01, Mike Chambers <mi...@watchfront.co.uk> wrote:
> Hi Mehdi,
>
> Thanks for pointing me in the right direction re: XSLT queries ; apologies for
> mis-posting - it's been a busy week getting up to speed with a whole host of new
> acronyms, concepts, and complex software packages.
>
> Best Regards,
> Mike
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>
>

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


Re: Problem with fo:external-graphic element in processing output from either Saxon or Xalan

Posted by Mike Chambers <mi...@watchfront.co.uk>.
Hi Mehdi,

Thanks for pointing me in the right direction re: XSLT queries ; apologies for
mis-posting - it's been a busy week getting up to speed with a whole host of new
acronyms, concepts, and complex software packages.

Best Regards,
Mike


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


Re: Problem with fo:external-graphic element in processing output from either Saxon or Xalan

Posted by mehdi houshmand <me...@gmail.com>.
Hi Mike,

I can't help you with the DocBook query as I've never used DocBook
myself, however, it is important to understand that XSL-FO and XML in
generally is strongly typed.

As for your XML all on one line, there is a way to output a more
readable format, I think you have to set indent="yes" on the
<xsl:output> object (http://www.w3schools.com/xsl/el_output.asp), but
again, I don't use XSLT very often so I'm not 100% on this. Also, in
future, if you have XSLT questions, could you ask them on the XLST
mailing list (http://www.mulberrytech.com/xsl/xsl-list/), this mailing
list is specifically for FOP questions.

Hope that helps

Mehdi

On 7 October 2011 10:05, Mike Chambers <mi...@watchfront.co.uk> wrote:
> Hi Mehdi,
>
> Ah OK thanks that makes sense, and now I understand the spec. that little bit
> better :) It would seem then that the block vs. inline concept is similar to
> that in HTML/CSS, but that in HTML you don't /have/ to explicitly wrap inline
> content with e.g. a block-level DIV, as you get something along the lines of an
> 'anonymous block box' (I think that is the terminology, and is what happens AIUI
> if you have e.g. <body>Hello world</body>, with no <p /> wrapping the text.).
>
> I manually added the wrapper <fo:block> object to the XSL-FO generated by Saxon
> and FOP processed it OK.
>
> OOI is it normal for an XSLT processor to output an XSL-FO (or indeed any other
> format) document that is a single (very long) line? It makes it harder to
> examine and then edit the structure of the document in a standard text editor.
> I'm puzzled as to why the processor output couldn't be multiline with suitable
> indentation. I know these are essentially machine processed files, but AIUI one
> of the points of XML is that a human can read it if they really want to.
>
> So now to find out why /both/ Saxon and Xalan generated XSL-FO output that
> omitted the same necessary wrapper object.
> Maybe because they were both using the same DocBook XSLT stylesheet(s) ?
> Would it be the case that the DocBook XSL stylesheet for generating FO output
> controls things such as when/where to put an <fo:block>? My logic & limited
> understanding of XSLT suggests it would, and thus maybe there is a bug in the
> XSLT stylesheet I have obtained via a Ubuntu repository package.
>
> Many Thanks,
> Mike
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>
>

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


Re: Problem with fo:external-graphic element in processing output from either Saxon or Xalan

Posted by Mike Chambers <mi...@watchfront.co.uk>.
Hi Mehdi,

Ah OK thanks that makes sense, and now I understand the spec. that little bit
better :) It would seem then that the block vs. inline concept is similar to
that in HTML/CSS, but that in HTML you don't /have/ to explicitly wrap inline
content with e.g. a block-level DIV, as you get something along the lines of an
'anonymous block box' (I think that is the terminology, and is what happens AIUI
if you have e.g. <body>Hello world</body>, with no <p /> wrapping the text.). 

I manually added the wrapper <fo:block> object to the XSL-FO generated by Saxon
and FOP processed it OK.

OOI is it normal for an XSLT processor to output an XSL-FO (or indeed any other
format) document that is a single (very long) line? It makes it harder to
examine and then edit the structure of the document in a standard text editor.
I'm puzzled as to why the processor output couldn't be multiline with suitable
indentation. I know these are essentially machine processed files, but AIUI one
of the points of XML is that a human can read it if they really want to.

So now to find out why /both/ Saxon and Xalan generated XSL-FO output that
omitted the same necessary wrapper object.
Maybe because they were both using the same DocBook XSLT stylesheet(s) ?
Would it be the case that the DocBook XSL stylesheet for generating FO output
controls things such as when/where to put an <fo:block>? My logic & limited
understanding of XSLT suggests it would, and thus maybe there is a bug in the
XSLT stylesheet I have obtained via a Ubuntu repository package.

Many Thanks,
Mike





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


Re: Problem with fo:external-graphic element in processing output from either Saxon or Xalan

Posted by mehdi houshmand <me...@gmail.com>.
Hi Mike,

An <external-graphic> an %inline entity, and the only valid child of
an <fo:flow> (http://www.w3.org/TR/xsl/#fo_flow) is a %block. So
basically you need to wrap the external-graphic object in a <fo:block>
object i.e.:

Your XSL-FO code:
...
<fo:flow>
  <fo:external-graphic>...</....

Correct XSL-FO:
...
<fo:flow>
  <fo:block>
    <fo:exteral-graphic>....</fo:external-graphic>
  </fo:block>
...

Hope that helps.

Mehdi

On 6 October 2011 14:30, Mike Chambers <mi...@watchfront.co.uk> wrote:
> Hi,
>
> I am getting this runtime error:
> org.apache.fop.fo.ValidationException:
> file:/home/mike/source/docbook/sample_doc2_xalan.fo:1:66363: Error(1/66363):
> fo:external-graphic is not a valid child element of fo:flow.
>
> after I added      <imagedata fileref="Screenshot1.png"/>
> to a very simple DocBook XML sourcefile
>
> I am new to DocBook, XSLT, XSL-FO etc. but looking at the XSL 1.0 specification
> at http://www.w3.org/TR/2001/REC-xsl-20011015/ i see "fo:flow formatting object
> is a sequence of flow objects" and "The fo:external-graphic flow object is used
> for a graphic where the graphics data resides outside of the XML result tree in
> the fo namespace.", implying fo:external-graphic /is/ a valid child element of
> fo:flow ?
>
> I am running FOP on a Ubuntu 10.04 Linux box, using the 'fop' package from the
> Ubuntu repositories.
>
> Maybe it is a Ubuntu package bug, so if anyone can point me at what I should
> look at to work out whether this is the case, or indeed suggest any other reason
> for this run-time error I would appreciate it.
>
> OOI, without the <imagedata/> element in the DocBook source, FOP runs OK and
> generates a usable PDF.
>
> It looks like I have FOP v0.95, judging from the content of the /usr/share/java
> directory.
>
> Thanks,
> Mike
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>
>

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