discuss: XML template
Subject:
Re: XML template
From:
Hal Burgiss ####@####.####
Date:
1 Oct 2001 15:40:50 -0000
Message-Id: <20011001114019.O19772@bellsouth.net>
On Mon, Oct 01, 2001 at 08:15:43AM -0700, David Lawyer wrote:
> On Thu, Aug 30, 2001 at 05:53:11PM -0400, Hal Burgiss wrote:
> > On Wed, Aug 29, 2001 at 07:27:34PM -0400, Hal Burgiss wrote:
> >
> > > Now I get a brainstorm that since I know Redhat pretty well, and
> > > Redhat based distros probably have a big chunk of the market, then
> > > to do a related doc called Security-Quickstart-Redhat, or whatever
> > > with some real step-by-step at each stage. The changes would be
> > > overall pretty minor. But now this is two docs, that have much
> > > duplication. How can I do conditional inclusion/exclusion?
> > >
> > > #ifdefine $redhat
> > > <text>
> > > #else
> > > <other text>
> > > #endif
> One way to do this is with the m4 preprocessor. I use linuxdoc, but
> it would be about the same for docbook. Example:
>
> see the section
> m4_ifdef( MODEM_ ,
> '" "What are UARTS" in the Serial-HOWTO. "')
> m4_ifdef( SERIAL_ ,
> '"<ref id="uart_" name="What Are UARTS?"> "')
>
> Here's an implied "else" after the , (the Serial-HOWTO: ...)
>
> See m4_ifdef( SERIAL_ , '"section <ref id="pinout_" name="Pinout and
> Signals">"', '"the Serial-HOWTO: Pinout and Signals"') for more
> details.
Interesting. I got suggestions from Nik and Jorge too. Right now I've
used Jorge's suggestion of using entities:
<!DOCTYPE Article PUBLIC "-//OASIS//DTD DocBook V3.1//EN"
[<!entity % redhat "INCLUDE"> <!entity % linuxall "IGNORE">]>
[...]
<sect2>
<title>Copyright</title>
<para>
Security-Quickstart HOWTO for <![%redhat;[Redhat]]> Linux
</para>
=========================
Which toggles inclusion of content based on the INCLUDE or IGNORE
statements. And works quite well! Pretty slick stuff actually IMO.
--
Hal Burgiss
--