Open oskarb opened 5 years ago
Try setting the DocBook stylesheet parameter keep.relative.image.uris to a value of 1.
http://docbook.sourceforge.net/release/xsl/current/doc/fo/keep.relative.image.uris.html
@bobstayton But that won't work for a large docbook material split over several files in subdirectories would it? For example with a subdirectory per chapter contains markup and image files - in the markup it would be most straightforward to reference the images using a path relative to the markup file (i.e. filename only) but the FO file will be just one file in the "root" directory, and the paths in that file should be relative to the location of the FO files. Which they will be because XInclude will set xml:base on the included material, but then that would be ignored if keep.relative.image.uris are enabled?
Yes, you are right, I misread the original description. In fact, the DocBook stylesheet generates the following when I test your setup and command: <fo:external-graphic src="url(dump.png)" .../> Note there is no SubDir in the path. Can you test with with the base DocBook XSL stylesheet? Are you setting the img.src.path parameter to 'SubDir'?
I can test more, but first let's verify versions and that I've reported this in the correct place.
My stylesheet customization begins with:
<xsl:import href="http://docbook.sourceforge.net/release/xsl/current/fo/docbook.xsl"/>
And these packages are installed:
$ dnf list '*docbook*'
Installed Packages
docbook-dtds.noarch 1.0-69.fc28 @fedora
docbook-style-dsssl.noarch 1.79-25.fc28 @fedora
docbook-style-xsl.noarch 1.79.2-7.fc28 @fedora
docbook-utils.noarch 0.6.14-45.fc28 @updates
docbook5-schemas.noarch 5.0-17.fc28 @fedora
docbook5-style-xsl.noarch 1.79.2-5.fc28 @fedora
My customization does not set img.src.path. It does set admon.graphics.path which I keep in a common directory - those work as expected. I don't set anything else that looks related to image paths. FOP extensions are enabled.
xsltproc in debug mode seems to indicate that it sees an xml:base attribute on the root article element that specifies "SubDir". This attribute is not present in the source file.
When running "make" from WorkDir, the executed commands will be:
xsltproc --xinclude -ouput SubDir/document.fo XSLFO-STYLESHEET SubDir/document.xml fop SubDir/document.fo -pdf SubDir/document.pdf
The problem is that FOP is unable to find the image file. This is because in the output FO file, the >image will be referenced
Running xsltproc and fop inside SubDir should fix the issue, ie.
xsltproc --xinclude -ouput document.fo XSLFO-STYLESHEET document.xml fop document.fo -pdf document.pdf
Would this fix your issue?
I'm not sure this is a bug but I haven't been able to find any documentation or similar that explains how to handle it.
I have a docbook file that references an image:
The full file structure is:
When running "make" from WorkDir, the executed commands will be:
xsltproc --xinclude -ouput SubDir/document.fo XSLFO-STYLESHEET SubDir/document.xml fop SubDir/document.fo -pdf SubDir/document.pdf
The problem is that FOP is unable to find the image file. This is because in the output FO file, the image will be referenced as:
So the image path is no longer relevant to the location of the file referencing it!
From FOP 2.0 released 2015 (https://xmlgraphics.apache.org/fop/2.0/changes_2.0.html), the location of the source FO document is used as default base to resolve relative paths (FOP-2306).