OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]

Subject: Re: [docbook-apps] Help requested with XInclude and fileref resolution problem

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

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

When processed in the set directory above, 
entity magic will resolve it to

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

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]