← Prev in month ← Prev in thread

DOCBOOK-APPS: modular docbook documents using xpointer

From
Arno Sosna <>
Date
2002-09-24T17:05:03+00:00
ID
Thread
DOCBOOK-APPS: modular docbook documents using xpointer
hello,

i have divided a book-file physically into separate files
and merge it using xinclude.

in the bookfile:
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" 
  href="chapter_dep.xml">
     <xi:fallback>
	<para>
	    <emphasis>chapter_dep.xml missing.</emphasis>
	</para>
     </xi:fallback>
</xi:include>

the part above includes a chapter, which lies in a separate file. 
the chapterfile is also a valid docbook document. simplified syntax:

<chapter>
   <chapterinfo>
       author, revisionhistory,...
   </chapterinfo>
   <title>foo</title>
   <sect1>...</sect1>
</chapter>

now i want to use xpath to choose just
some parts of the files, or to be exact, i want to exclude
certain elements and their sibblings (the whole
chapterinfo-block from chapter).

so far, i have "developed" following syntax:

<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="chapter.xml#xpointer(/chapter/*[not(descendant-or-self::chapterinfo)])
">

this outputs all elements WITHIN <chapter> except the elements enclosed in
<chapterinfo>, which is not bad, but still not complete, as the <chapter>
tags are not reached by this. they have to present, without them the
book-file is not valid (naturally). [workaround: i insert the missing tags
into my book-file by hand.]

i'd like to have following output format:

<chapter>
   <title>foo</title>
   <sect1>...</sect1>
.
.
.
</chapter>

what seems like a simple step is causing me real headaches. has anybody a
solution for this? or am i going the completly wrong way and there is a much
simpler way to achieve "selective output"?

i use xmllint from libxml2 on a win2k machine for xinclude. 

thanks a lot,
arno sosna
← Prev in month ← Prev in thread