Docbook 5 to webhelp: using folders

Having trouble installing Oxygen? Got a bug to report? Post it all here.
Fran Pena
Posts: 6
Joined: Fri Dec 16, 2011 2:04 pm

Docbook 5 to webhelp: using folders

Post by Fran Pena »

Hi,

I am trying to create a proyect where xml files are distributed through some folders. When I try to transform it using the docbook5 to Webhelp predefined scenario, I get a wrong result. As an example, I attach a main.xml that calls a intro2.xml file, stored in the sub folder:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="http://www.oasis-open.org/docbook/xml/5.0/rng/docbookxi.rng" schematypens="http://relaxng.org/ns/structure/1.0"?>
<book xmlns="http://docbook.org/ns/docbook"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0">
<title>book</title>
<part>
<title>First Part</title>
<xi:include href="sub/intro2.xml"/>
</part>
</book>

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="http://www.oasis-open.org/docbook/xml/5.0/rng/docbookxi.rng" schematypens="http://relaxng.org/ns/structure/1.0"?>
<chapter xmlns="http://docbook.org/ns/docbook"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0">
<title>Chapter Title</title>
<sect1><title>Sect1 Title</title>
<para>Text</para>
</sect1>
</chapter>
Sincerely,
Fran Pena
Radu
Posts: 9446
Joined: Fri Jul 09, 2004 5:18 pm

Re: Docbook 5 to webhelp: using folders

Post by Radu »

Hi Fran,

What do you mean exactly by "wrong result"?
We tried to produce WebHelp output from your small samples and the result looked OK.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Fran Pena
Posts: 6
Joined: Fri Dec 16, 2011 2:04 pm

Re: Docbook 5 to webhelp: using folders

Post by Fran Pena »

Hi Radu,

sorry for the mistake! The intro2.xml that I have should attached is:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="http://www.oasis-open.org/docbook/xml/5.0/rng/docbookxi.rng" schematypens="http://relaxng.org/ns/structure/1.0"?>
<chapter xmlns="http://docbook.org/ns/docbook"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0">
<title>Chapter Title</title>
<sect1>
<title>Section1 Title</title>
<para>
AAAAAAAAAAAA
<inlinemediaobject><imageobject><imagedata fileref="images/example001.png"/></imageobject></inlinemediaobject>
AAAAAAAAAAAA
</para>
</sect1>
</chapter>
In this file, the image "images/example001.png" is used. I stored this image in ./sub/images, but the image does not appear in the webhelp (that's why I said "wrong").

I have realized that the webhelp is correct if I store the image in ./images (not in ./sub/images). The problem is that I would like to have a lot o subfolders (since I have a lot of chapters) and I would like to store the images related to each chapter in the same subfolder where the xml files are.

Sincerely,
Fran
Radu
Posts: 9446
Joined: Fri Jul 09, 2004 5:18 pm

Re: Docbook 5 to webhelp: using folders

Post by Radu »

Hi Fran,

The ANT build file which manages the WebHelp output can be found here:

OXYGEN_INSTALL_DIR/frameworks/docbook/xsl/webhelp/build.xml

It does not have a very smart approach with regard to image references, basically it searches for a folder called images in the main Docbook folder and copies it to the output directory without any additional changes. If you want some other type of handling for images you will have to modify the ANT tasks yourself.

So based on what is written here:

http://www.sagehill.net/docbookxsl/ModularDoc.html
A relative fileref processed with XInclude and with keep.relative.image.uris="1" is always copied without change (this is the default setting for HTML output).
The default behavior is to keep the path to the image unchanged in the resulting HTML document (and disregard the fact that the module will actually be part of a larger document with a different base URL).

In my opinion the best for you would be to keep a single "images" folder in the root folder (where the main Docbook XML is located) and then in the XI:included modules add an xml:base="../" attribute on the root element, thus having all relative references in the module files interpreted relative to the main parent Docbook directory.
Or you could keep all modules + the main XML file in the same directory of course.

I think you should also write about this situation on the Docbook Users List, they might have better approaches for you.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Fran Pena
Posts: 6
Joined: Fri Dec 16, 2011 2:04 pm

Re: Docbook 5 to webhelp: using folders

Post by Fran Pena »

Thank you for your help, Radu.

I will take your advise and I will ask in the DocBook forum.

Sincerely,
Fran Pena
Post Reply