This is the mail archive of the
docbook-apps@lists.oasis-open.org
mailing list .
modular docbook documents using xpointer
- From: Arno Sosna <Arno dot Sosna at update dot com>
- To: "'docbook-apps at lists dot oasis-open dot org'" <docbook-apps at lists dot oasis-open dot org>
- Date: Tue, 24 Sep 2002 15:31:32 +0200
- Subject: 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