This is the mail archive of the
docbook@lists.oasis-open.org
mailing list for the DocBook project.
Re: inserting literal text files
- To: docbook at lists dot oasis-open dot org
- Subject: Re: DOCBOOK: inserting literal text files
- From: Norman Walsh <ndw at nwalsh dot com>
- Date: Tue, 1 Feb 2000 11:06:02 -0500
- References: <3E44162A0A0AD21192A200AA00AD2D73107324@cloanto.com> <3894F92B.E014A4A7@mandrakesoft.com>
- Reply-To: docbook at lists dot oasis-open dot org
/ Camille Begnis <camille@mandrakesoft.com> was heard to say:
| I have to insert in my document some literal blocks of text from simple
| text files (typically some code).
| How do I achieve that?
|
| I tried something like that:
| <!ENTITY % Xsnippet SYSTEM "fr/snippet.txt">
| <!ENTITY snippet &Xsnippet;>
That's a bit redundant, it's the same as
<!ENTITY snippet SYSTEM "fr/snippet.txt">
Unfortunately, this doesn't work. Well, actually, it does
"work", but it doesn't do what you want. ;-) With this
declaration &snippet; is replaced by the content of
fr/snippet.txt, but that document is interpreted as SGML.
Now, you could say
<!ENTITY snippet SYSTEM "fr/snippet.txt" NDATA "linespecific">
But that won't work either. You can't use &snippet; in your text
if it isn't SGML.
Depending on your processing system, you have a few options. You can
hack an existing element, like ulink
<ulink role="embed" url="fr/snippet.txt></ulink>
if you can change the processing system to support it.
Personally, I use the following "hack"
<inlinegraphic fileref="fr/snippet.txt" format="linespecific">
My DSSSL stylesheets support this and the XSL stylesheets support it
with a little post-processing.
The long-term general solution to this problem is XLink.
Cheers,
norm
--
Norman Walsh <ndw@nwalsh.com> | Wandering in a vast forest at
http://www.oasis-open.org/docbook/ | night, I have only a faint light
Member, DocBook Editorial Board | to guide me. A stranger appears
| and says to me: "My friend, you
| should blow out your candle in
| order to find your way more
| clearly." This man is a
| theologian.--Diderot