We don't have that problem because we're not currently translating, but I'd 
like to suggest an alternate approach that might help. We're keeping all of our 
DocBook source  (XML and images) in a Subversion repository for change 
management, and Subversion has a feature called "externals". Instead of trying 
to fix this in DocBook/XML/FO, you could keep each language's XML and images in 
Subversion, and for images that are common across translations, use an external 
to point to the image under the en/ directory. It still uses all the space on 
the disk where you're building the FO, but when you update the image, all the 
externals that refer to it will also update when they are next pulled from the 
repository. We're currently using this for things like XSD files that appear in 
the reference section of the manual and are also part of the source tree for 
the application, so if we update the application, the documentation follows 
automatically.

Regards,
Paul Bort
Systems Engineer
TMW Systems, Inc.
[email protected]<mailto:[email protected]>

From: Ola Widin [mailto:[email protected]]
Sent: Friday, September 21, 2012 8:51 AM
To: [email protected]
Subject: [docbook-apps] XML catalogs, images and PDF

Hi there,

Is there anybody out there who has managed to get an XSL-FO renderer to resolve 
image file locations using XML catalogs (or using any other neat trick)?

I have struggled with this for some time now but not managed to come up with a 
working solution, and I'm starting to believe that it is not my XML-fu that is 
limited, but that it is actually not possible with the tools I've used.

More specifically:
We have a manual that consists of several XML files containing the chapters, 
and a main XML file that just uses XInclude to "collect" the chapters. All XML 
files are located in the same folder (in this case called "en/"). In this 
folder, there is also an "images" folder that contains all the images included 
in the manual (using <imagedata fileref="images/image_file_name.pdf"). 
Generating a PDF for the manual works fine, as long as all referred images are 
present in the "images" folder.

When we translate the manual we send all the (english) XML files to the 
translators, and for each language we get back a set of XML files with the 
"readable" content translated but everything else unchanged - file names, 
xml:id attributes, and fileref attributes for images. The images seldom 
contains anything that needs to be translated, and if they do we take care of 
that ourselves. When generating PDF:s for the translated manuals, we currently 
have to copy the entire "images" folder from the "en" folder to  each folder 
with the translated manuals, and then make sure that we correctly replace the 
few translated images.

Now, what I hoped would be possible with XML catalogs was to get the XSL-FO 
renderer to look for the images in multiple locations:
- First look in the "images" folder in the folder with the current XML files
- if the image file was not found there, look in the "en/images" folder

This way we would not have to fill the "images" folder for each translation 
with identical copies of the un-translated images, and instead keep only one 
copy in the "en/images" folder. It would also be easier to check that all 
images that need translation are actually translated, since the "images" folder 
for the translated manual would only contain translated images.

So far I have tried using both XEP (that we currently use for generating PDFs) 
and FOP (as an experiment), and xsltproc, Saxon (6.5.5) and Xalan for 
generating the FO files, but nothing has worked for me. I must have tried every 
trick I could find on the interwebs on how to get these tools to resolve using 
XML catalogs, but have this far only managed to get xsltproc to resolve the 
XIncludes in the main XML file (but never Saxon or Xalan).

Best Regards
/Ola

---
Ola Widin

Kanin Design Information & Interaktion
Phone: +46 (0) 709-37 86 10
E-mail: [email protected]<mailto:[email protected]>



Reply via email to