This is the mail archive of the
docbook-apps@lists.oasis-open.org
mailing list .
Automatic copying of text between chapters
- From: dbook at centrum dot cz
- To: docbook-apps at lists dot oasis-open dot org
- Date: Wed, 03 Apr 2002 21:34:35 +0200
- Subject: DOCBOOK-APPS: Automatic copying of text between chapters
Hello,
do you now some docbook's construction, which provides automatic
copying of text from one chapter to other?
Specially, i make in docbook course of c-language. I need to
place exercises for students into end of every chapter and
solutions with exercises again into appendix. Because exercises
and solutions are large and will be often updated, i want to
update it only in appendix. And into end of chapters i want only
copy text of exercise from appendix and put there link to
solution. Is it possibly?
My idea:
This is "main" file:
---------------------------------------------------------------
<!DOCTYPE book PUBLIC "-//OASIS//DTD Docbook XML V4.1.2//EN"
"file:///d:\DocBook\DOCBOOK\docbookx.dtd"
[
<!ENTITY some_alias SYSTEM "file.xml">
<!ENTITY some_alias2 SYSTEM "file2.xml">
...
]>
<book lang="cs">
...
<appendix>
<title>...
&some_alias;
&some_alias2;
&some_alias3;
...
</appendix>
...
---------------------------------------------------------------
And this is in 'file.xml':
---------------------------------------------------------------
<section>
<title>Exercises with solutions from chapter 1</title>
<exercise> bla bla bla bla bla bla bla bla bla bla </exercise>
<solution id="ex1"> ble ble ble ble ble ble ble ble ble ble
</solution>
...
</section>
---------------------------------------------------------------
Every section with multiple exercises/solutions is equal to one
chapter.
Every section is placed to one XML file.
On the end of chapters i placed:
---------------------------------------------------------------
<exe-sol>
&some_alias;
</exe-sol>
<link linkend="ex1">Link</link> to solution
---------------------------------------------------------------
Here is structure of <exe-sol>:
---------------------------------------------------------------
<xsl:template match="exe-sol">
<div class="exe-sol">
<xsl:apply-templates select="section/exercise"/>
</div>
</xsl:template>
---------------------------------------------------------------
Problem is, that it makes link to actual chapter, not to
appendix/section
(multiple "IDs" for constraint linkend:...).
Do you have some idea?
Thank you,
Petr Rajsky
--------------------
Centrum pro milovníky peněz http://finance.centrum.cz