← Prev in month
← Prev in thread
Re: DOCBOOK: inserting literal text files
/ Camille Begnis <> 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 <> | 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
← Prev in month
← Prev in thread