Thank you for the suggestion.
When I think about it, this could actually work better than my approach: if (when) we have to edit the translated manuals, I'm afraid that the XML editor would not be able to locate the images either, which makes it a bit harder to work with the manual. With your Subversion solution it wouldn't be a problem.
Kanin Design Information & Interaktion
Phone: +46 (0) 709-37 86 10
21 sep 2012 kl. 15:06 skrev Bort, Paul:
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. From: Ola Widin [mailto:firstname.lastname@example.org]
Sent: Friday, September 21, 2012 8:51 AM
Subject: [docbook-apps] XML catalogs, images and PDF
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.
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).
Kanin Design Information & Interaktion Phone: +46 (0) 709-37 86 10