Re: [docbook-apps] XML catalogs, images and PDF

From
Ola Widin <>
Date
2012-09-24T15:45:04+00:00
ID
Thread
Re: [docbook-apps] XML catalogs, images and PDF
Hi Bob. 

I did try a few similar hints that I found on the intertubes - changing classpaths, using java commands with various options, etc. - but they never made any difference that I could tell.

It almost seems to me that in general, XML catalogs are used for resolving DTDs and other things that contain XML, but not for resolving other types of resources such as images. While hunting for hints on how to get it working, I found this comment on the FOP wiki, regarding the -catalogs option that has been added to FOP:

"Even with the -catalog option the catalog resolver is not used for image retrieval. (Maybe it should, but it has not been thought of.)"

And I think this was actually the only hint I found that mentioned how images *are* treated, instead of how they *could be* treated by tools supporting XML catalogs.

So, I'm going to talk to the IT people here to see if we can solve this using Subversion instead of XML. 

Best Regards

/Ola

---

Ola Widin

Kanin Design Information & Interaktion

Phone: +46 (0) 709-37 86 10

E-mail: 

21 sep 2012 kl. 17:40 skrev Bob Stayton:

Hi Ola,

I have configured XEP to use an XML catalog, not for image 
locations but to use a local SVG DTD when processing images that reference such 
a DTD.  I edited the xep.bat batch file (I'm running on Windows) to add two 
items to the java CLASSPATH:

 

resolver.jar

directory containing the CatalogManager.properties file, that 
points to an xml catalog file.

 

Then you add these options to the java command line in that 
file:

 

-Dcom.renderx.sax.entityresolver=org.apache.xml.resolver.tools.CatalogResolver 

-Dcom.renderx.jaxp.uriresolver=org.apache.resolver.tools.CatalogResolver

 

When first setting up a catalog, I usually set verbosity=4 in 
the CatalogManager.properties file so I can see how the catalog file is being 
used during the process.  Then set it back to 1 when everything is 
working.

 

Bob Stayton
Sagehill Enterprises


From: Ola Widin 

Sent: Friday, September 21, 2012 5:50 AM

To:  

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: