This is the mail archive of the
docbook-apps@lists.oasis-open.org
mailing list .
Re: XInclude problems
On Wed, Feb 05, 2003 at 10:18:28AM +0100, Kenneth Johansson wrote:
> Ah, I misinterpreted the part of the "Using Docbook XSL Stylesheets" guide that discusses nested XIncludes.
>
> How would I go about if i wanted a completely modular set of xml-files. I would like to be able to for instance have a generic chapter called "Introduction" which I can use in many guides. Since sections inside the chapter may differ greatly between guides, it would be difficult to use XIncludes inside the introduction file.
>
> Am I missing something? Is there a better way?
Yes, you can xinclude parts of a file, and construct your
chapter as a linear sequence of includes. I would suggest
you create a "chapter" that contains just the introductory
material you want in all versions. Then you can select
everything inside its chapter element but not including the
chapter element with an xpointer URI.
So your master book file for a version might look like this:
<book>
<chapter id="mychapter">
<xi:include href="chapintro.xml.xml#xpointer(/chapter/*)"
parse="xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
<xi:include href="firstsect.xml"
parse="xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
<xi:include href="secondsect.xml"
parse="xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
...
</chapter>
</book>
The xpointer(/chapter/*) will select all elements inside
the intro chapter element, but no the chapter element itself.
The chapter wrapper in the master book file puts it
all together.
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