[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: SGML question



Gerard Beekmans <gerard@linuxfromscratch.org> writes:

> Suppose I have the following entity:
> 
> <!ENTITY chapter1 SYSTEM "textblock.sgml">
> 
> Chapter 1 of the book calls this file with a &textblock;
> Chapter 2 also uses this block but that block needs to be modified a bit
> (it's the installation of the same program, but a different procedure
> for a different platform. It has an extra paragraph or two).
> 
> To avoid copy/pasting it literally I want to use &textblock; in both
> files (chapter1.sgml and chapter2.sgml) but when it's called in
> chapter2.sgml it should have an extra paragraph. Can I mark a section in
> the textblock.sgml file which is only displayed when the calling file is
> chapter2.sgml or when called with an extra parameter or something like
> that?
> 
> If not, then I just have to split up textblock.sgml in two files
> textblock1.sgml and textblock2.sgml. In chapter1 I include the files
> with:
> &textblock1;
> &textblock2;
> 
> and in chapter2.sgml
> &textblock1;
> <para>Here a few extra lines</para>
> &textblock2;
> 
> The latter option isn't too bad to do, but I'd prefer to enable a
> section.
> 
> Anybody got some suggestions how to proceed? thanks in advance.

I have. Sorry for quoting all the message but I think it's interesting
for archiving purposes.

In your main file:

<!doctype .... >
<!entity % chap2extra "IGNORE">
...

In "textblock.sgml" do this:

(text)
(now the paragraph that will be shown in chapter2)

<![%chap2extra;[
<para>This paragraph will be shown only if chap2extra's value is
"INCLUDE". </para> 
]]>


At the beginning of your chap2.sgml, put:
<!entity % chap2extra "INCLUDE">

And the extra paragraph will be there. 



Another solution is to include parts of SGML documents, based on their
IDs. IIRC, you need to:

<!entity partialchap1 SYSTEM "chapter1.sgml#thisid">

and this element and all it's child elements will be included at your
document. This is good for documentation reuse (I imagine a file with
lots of licenses --- actualized by your legal department --- and you
only choose which license you'll be using). 



If you have any problems, please write me and I can try helping you. 



Regards,
-- 
Godoy.	<godoy@conectiva.com> 

Departamento de Publicações
Publishing Department                   Conectiva S.A.


--  
To UNSUBSCRIBE, email to ldp-discuss-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org


mirror server hosted at Truenetwork, Russian Federation.