This is the mail archive of the
docbook-apps@lists.oasis-open.org
mailing list .
Re: [docbook-apps] Help requested with XInclude and fileref resolution problem
- From: Bob Stayton <bobs at sco dot com>
- To: Taro Ikai <tikai at ABINITIO dot COM>
- Cc: Docbook-Apps <docbook-apps at lists dot oasis-open dot org>
- Date: Wed, 10 Sep 2003 23:14:54 -0700
- Subject: Re: [docbook-apps] Help requested with XInclude and fileref resolution problem
- References: <OFAF841B82.AD283CF9-ON85256D9D.006F7472-85256D9D.0071E768@abinitio.com>
On Wed, Sep 10, 2003 at 04:43:54PM -0400, Taro Ikai wrote:
> I have a modularized doc set whose directory structure
> looks like this:
>
> docroot/sub1/figures
> docroot/sub2/figures
> ...
> docroot/sub(n)/figures
>
> At the 'docroot' level, I have a document whose toplevel
> element is a <set>, which XIncludes the main document
> from each of the sub(n) directories.
>
> The <book> document in each of the sub(n) directory in turn
> XIncludes many <chapter> documents in the given directory.
>
> To enable partial build of the large doc set, I've set up
> Makefiles in both docroot/ and each of its subdirectories.
>
> In other words, I can process either docroot/set.xml that
> XIncludes all <book>s:
>
> <xi:include href="sub1/book.xml"/>
> ...
> <xi:include href="sub(n)/book.xml"/>
>
> or, docroot/sub(n)/book.xml that XIncludes all chapter of
> the given <book>
>
> <xi:include href="chapter1.xml"/>
> ..
> <xi:include href="chapter(n).xml"/>
>
> This works well except for one problem. In a given chapter
> file, say,
>
> docroot/sub1/chapter1.xml
>
> I have a <graphic> element to a file in the corresponding
> subdirectory: docroot/sub1/figures/foo.bmp:
>
> <graphic fileref="figures/foo.bmp"/>
>
> This works well when I process docroot/sub1/book.xml.
> But not when I process docroot/set.xml.
>
> When the whole set is processed, the @fileref value
> remains "figures/foo.bmp" instead of "sub1/figures/foo.bmp",
> and the graphic does not show.
>
> How should I solve this problem?
Use entityrefs instead of filerefs in the imagedata
elements.
For example, in a book document in sub1 directory:
<!DOCTYPE book SYSTEM "docbookx.dtd" [
<!ENTITY foo-fig SYSTEM "figures/foo.bmp" NDATA BMP>
]>
...
<imagedata entityref="foo-fig">
...
When processed with xsltproc in the book directory, the
fo/docbook.xsl stylesheet will resolve this to
src="url(figures/foo.bmp)".
When processed in the set directory above,
entity magic will resolve it to
src="url(sub1/figures/foo.bmp)".
You will, however, need to add xml:base to the
DocBook common attributes, because xsltproc will
add such an attribute when it resolves the
xinclude in order to keep track of such entities.
It puts xml:base on the book element that
it includes in the set document.
So add this to your set document DOCTYPE:
<!DOCTYPE set SYSTEM "docbookx.dtd" [
<!ENTITY % local.common.attrib "xml:base CDATA #IMPLIED">
]>
When DocBook 4.3 is finished, it will have xml:base
as a common attrib and you won't need to do this.
--
Bob Stayton 400 Encinal Street
Publications Architect Santa Cruz, CA 95060
Technical Publications voice: (831) 427-7796
The SCO Group fax: (831) 429-1887
email: bobs@sco.com
To unsubscribe from this list, send a post to docbook-apps-unsubscribe@lists.oasis-open.org.