first of, I don’t know much about XSL.
I am using a app called DITA to generate pdfs. One of the things it requires is an overwrite of an xsl file; to add custom styling.
I am trying to add an external graphic using a relative path. It doesn’t work, unless I supply the full path.
Does not work:
<fo:block text-align="center" width="100%">
<fo:external-graphic src="../../images/logo.png"/>
</fo:block>
Does work:
<fo:block text-align="center" width="100%">
<fo:external-graphic src="/absolute/path/to/images/logo.png"/>
</fo:block>
I looked on the web, it said to use “file:image.png” and other website said to use “url(image.png)”, but neither worked.
What am I doing wrong?
This is an old question but something that is often misunderstood when working with DITA-OT.
The important thing to know is that the external-graphic path is relative to the DITA-OT artwork.dir.
I can think of two ways to do add the logo.
The easy way
Copy logo.png into the arwork diretory
Change your xsl graphic path to
The harder way
It is possible to change the artwork directory from which DITA takes it’s pictures as well as the output directory which will be used by FOP to render the PDF.
open the build.xml file
Artwork root
Define the root directory where DITA should copy the artwork to
The default is
Which will set the root to where your final PDF will be saved.
Artwork destination
Define the path where the files should be stored relative to the artwork root directory
By default it will create the folders
/Configuration/OpenTopicand then copy everything in there including sub directories.Make sure to change the destination twice. The two places you have to edit are only a few lines apart.
Artwork source
Define where the original artwork is saved so that DITA-OT can copy the files to the destination.
The first line points to the default artwork that come with DITA-OT and should not be changed.
The second one is intended for customizing thus being the one that should be used for customization.
The path is relative to DITA-OT/demo/fo/Customization.