| 1 |
<?xml version="1.0" encoding="utf-8"?>
|
| 2 |
|
| 3 |
<!DOCTYPE article PUBLIC "-//Norman Walsh//DTD DocBk XML V3.1//EN"
|
| 4 |
"dtd/docbook-xml/docbookx.dtd"[
|
| 5 |
|
| 6 |
<!-- TODO: a <man> element with a link to -->
|
| 7 |
<!-- http://www.sources.org/cgi-bin/dwww?type=man&location=/usr/man/man1/sgml2latex.1.gz for the HTML output -->
|
| 8 |
|
| 9 |
<!-- TODO: includes the programlisting into their paragraphs? -->
|
| 10 |
|
| 11 |
<!-- TODO: externalize the following declarations in other -->
|
| 12 |
<!-- files. Warning: this will mean a validating XML parser to treat -->
|
| 13 |
<!-- the conditionals. First attemps with XML::Checker are not -->
|
| 14 |
<!-- convincing. -->
|
| 15 |
<!-- A possible alternative would be to "rxp -e" before processing -->
|
| 16 |
<!-- it. -->
|
| 17 |
|
| 18 |
<!-- Programs -->
|
| 19 |
<!ENTITY sgmltools2 '<link linkend="sgmltools2">SGMLtools, version 2</link>'>
|
| 20 |
<!ENTITY sgmltools1 '<link linkend="sgmltools1">sgml-tools, version 1</link>'>
|
| 21 |
<!ENTITY jade '<link linkend="jade">jade</link>'>
|
| 22 |
<!ENTITY jadetex '<link linkend="jadetex">jadetex</link>'>
|
| 23 |
<!ENTITY psgml '<application>Emacs</application>' SGML mode, <link linkend="psgml">psgml</link>'>
|
| 24 |
<!ENTITY modular_ss '<link linkend="modularss">Modular DocBook Stylesheets</link>'>
|
| 25 |
|
| 26 |
<!-- Files -->
|
| 27 |
<!ENTITY print_ss
|
| 28 |
'/usr/lib/sgml/stylesheet/dsssl/docbook/nwalsh/print/docbook.dsl'>
|
| 29 |
<!ENTITY html_ss
|
| 30 |
'/usr/lib/sgml/stylesheet/dsssl/docbook/nwalsh/html/docbook.dsl'>
|
| 31 |
<!ENTITY xml_decl '<filename>/usr/lib/sgml/declaration/xml.decl</filename>'>
|
| 32 |
|
| 33 |
<!-- New elements -->
|
| 34 |
|
| 35 |
<!-- The contents of the debianpackage element is the official name -->
|
| 36 |
<!-- The name attribute holds the Debian name, if it's different -->
|
| 37 |
<!ELEMENT debianpackage (#PCDATA)>
|
| 38 |
<!ATTLIST debianpackage name CDATA #IMPLIED>
|
| 39 |
<!ATTLIST debianpackage refserver CDATA #IMPLIED>
|
| 40 |
<!ENTITY % local.title.char.mix
|
| 41 |
"|debianpackage">
|
| 42 |
|
| 43 |
<!ELEMENT debiandoc (#PCDATA)>
|
| 44 |
<!ATTLIST debiandoc file CDATA #IMPLIED>
|
| 45 |
<!ATTLIST debiandoc text CDATA #IMPLIED>
|
| 46 |
<!ENTITY % local.para.char.mix
|
| 47 |
"|debiandoc|debianpackage">
|
| 48 |
|
| 49 |
<!ELEMENT manpage (#PCDATA)>
|
| 50 |
|
| 51 |
<!-- New attributes -->
|
| 52 |
<!ENTITY % local.common.attrib
|
| 53 |
"debianversionequal CDATA #IMPLIED
|
| 54 |
debianversionmin CDATA #IMPLIED
|
| 55 |
debianversionmax CDATA #IMPLIED">
|
| 56 |
|
| 57 |
|
| 58 |
]>
|
| 59 |
|
| 60 |
<article>
|
| 61 |
|
| 62 |
<artheader>
|
| 63 |
<title>The Debian SGML/XML HOWTO</title>
|
| 64 |
<author>
|
| 65 |
<firstname>Stéphane</firstname>
|
| 66 |
<surname>Bortzmeyer</surname>
|
| 67 |
<affiliation>
|
| 68 |
<orgname>The Debian Project</orgname>
|
| 69 |
<address><email>bortzmeyer@debian.org</email></address>
|
| 70 |
</affiliation>
|
| 71 |
</author>
|
| 72 |
<othercredit>
|
| 73 |
<contrib>Spelling and grammar fixes</contrib>
|
| 74 |
<firstname>Guy</firstname>
|
| 75 |
<surname>Brand</surname>
|
| 76 |
<affiliation>
|
| 77 |
<address><email>guybrand@chimie.u-strasbg.fr</email></address>
|
| 78 |
</affiliation>
|
| 79 |
</othercredit>
|
| 80 |
<othercredit>
|
| 81 |
<contrib>Spelling, grammar and style fixes</contrib>
|
| 82 |
<firstname>John</firstname>
|
| 83 |
<surname>van der Koijk</surname>
|
| 84 |
<affiliation>
|
| 85 |
<address><email>jvdkoijk@wirehub.nl</email></address>
|
| 86 |
</affiliation>
|
| 87 |
</othercredit>
|
| 88 |
<releaseinfo>$Id: howto.db,v 1.13 2000-01-27 09:48:36 bortz Exp $</releaseinfo>
|
| 89 |
<copyright>
|
| 90 |
<year>1999</year>
|
| 91 |
<holder>Stéphane Bortzmeyer</holder>
|
| 92 |
</copyright>
|
| 93 |
<legalnotice>
|
| 94 |
<para>This text is distributed according to the <ulink url="http://www.gnu.org/copyleft/gpl.html">General
|
| 95 |
Public License</ulink>.</para>
|
| 96 |
</legalnotice>
|
| 97 |
</artheader>
|
| 98 |
|
| 99 |
<sect1>
|
| 100 |
<title>Why this HOWTO? What's in it?</title>
|
| 101 |
<para>This section explains why this HOWTO exist and which people
|
| 102 |
it tries to help. It could be useful to read it first, before you
|
| 103 |
lose time.</para>
|
| 104 |
<sect2>
|
| 105 |
<title>What is in the HOWTO</title>
|
| 106 |
<para>This HOWTO contains <emphasis>practical</emphasis>
|
| 107 |
information about the use of SGML and XML on a Debian operating
|
| 108 |
system.</para>
|
| 109 |
<para>The HOWTO is task-oriented: you will see what Debian packages you will need for
|
| 110 |
various tasks, and how to use them. It is intended for hurried
|
| 111 |
people, who do not like to read and understand everything before
|
| 112 |
starting
|
| 113 |
and who prefers "hands on" training.
|
| 114 |
</para>
|
| 115 |
<para>We will cover SGML (and its subset XML), some DTD which I
|
| 116 |
find important and the tools to write, format and display SGML,
|
| 117 |
whether on the Web or in printing. The emphasis will be on SGML
|
| 118 |
as a way to write documentation, not as a general data
|
| 119 |
interchange tool.</para>
|
| 120 |
</sect2>
|
| 121 |
<sect2>
|
| 122 |
<title>What's not in the HOWTO</title>
|
| 123 |
<para>You will not find anything about installing and setting up
|
| 124 |
software, since we assume a Debian system, where everything is
|
| 125 |
already packaged. We will use only Debian packages, as they are
|
| 126 |
shipped with <phrase debianversionequal="2.2">Debian 2.2, nicknamed 'potato' (not yet ready when
|
| 127 |
writing this)</phrase><phrase debianversionequal="2.1">Debian 2.1, nicknamed
|
| 128 |
'slink'</phrase>.</para>
|
| 129 |
<para>This is not a tutorial on SGML or XML. Refer to
|
| 130 |
<xref linkend="references"/> for that type of information.
|
| 131 |
Instead, you will get just enough
|
| 132 |
SGML to get you started
|
| 133 |
right now.</para>
|
| 134 |
</sect2>
|
| 135 |
<sect2>
|
| 136 |
<title>Meta-information about this HOWTO</title>
|
| 137 |
<para>This HOWTO is itself written in DocBook (XML) on a Debian
|
| 138 |
system. The HOWTO can be retrieved from <ulink
|
| 139 |
url="http://www.debian.org/~bortz/SGML-HOWTO/">my Web
|
| 140 |
page</ulink>, including its <ulink
|
| 141 |
url="http://www.debian.org/~bortz/SGML-HOWTO/howto.db">source code</ulink>.</para>
|
| 142 |
</sect2>
|
| 143 |
<sect2>
|
| 144 |
<title>Why is this HOWTO specific to Debian?</title>
|
| 145 |
<para>I said the purpose was to start quickly, remember? This
|
| 146 |
means using actual filenames, actual commands and not wasting
|
| 147 |
time compiling <application>jade</application>. And I hate to insert "Your mileage way
|
| 148 |
vary" warnings everywhere. Therefore, I chose a specific
|
| 149 |
operating
|
| 150 |
system and I used the best one, <ulink
|
| 151 |
url="http://www.debian.org/">Debian</ulink>, which is also the
|
| 152 |
only one with an integrated SGML environment... Even if it is not
|
| 153 |
perfect, it works and, with this HOWTO, it even has a
|
| 154 |
documentation.</para>
|
| 155 |
<para>I added some pointers to <link linkend="otheros">other
|
| 156 |
operating systems</link>.</para>
|
| 157 |
</sect2>
|
| 158 |
</sect1>
|
| 159 |
|
| 160 |
<sect1>
|
| 161 |
<title>What you really need to know about SGML</title>
|
| 162 |
<para>I tried to keep this section short. However, I cannot
|
| 163 |
explain anything without a small basis of concepts about SGML. So,
|
| 164 |
let's go, before we switch to actual source code.</para>
|
| 165 |
<sect2>
|
| 166 |
<title>What is structured documentation?</title>
|
| 167 |
<para>Structured documentation is built upon structured elements:
|
| 168 |
chapters, sections, paragraphs, etcetera, where all elements
|
| 169 |
are clearly labeled for
|
| 170 |
what they are: references, program output, etc. No explicit information
|
| 171 |
about how the document should be rendered is given;
|
| 172 |
only about its structure (and content).
|
| 173 |
When there are explicit rules for presentation, they are kept
|
| 174 |
outside the SGML-document.</para>
|
| 175 |
<para>This allows for automatic processing of the documents, without
|
| 176 |
waiting for AI systems. It encourages authors to concentrate on
|
| 177 |
structure, which conveys meaning. </para>
|
| 178 |
<para>Thus, the question "How do I put a word in bold with
|
| 179 |
SGML?" has little relevance. One <emphasis>could</emphasis> ask
|
| 180 |
how to put emphasis on a certain stretch of text.</para>
|
| 181 |
</sect2>
|
| 182 |
<sect2>
|
| 183 |
<title>What is SGML?</title>
|
| 184 |
<para>Standard Generalized Markup Language is a standardized
|
| 185 |
language intended to facilitate the authoring of
|
| 186 |
structured documentation
|
| 187 |
<footnote><para>It has
|
| 188 |
other uses, such as data interchange.</para></footnote>. More
|
| 189 |
specifically, it is a meta-language. You never actually type
|
| 190 |
SGML, but SGML is used to describe
|
| 191 |
a document type specific structured language
|
| 192 |
(this is called a DTD, a Document Type
|
| 193 |
Definition), which defines how specific documants might be
|
| 194 |
structured (written).</para>
|
| 195 |
<para>Therefore, saying that a document is "in the SGML format"
|
| 196 |
is technically correct, but deceptive. One could say that a
|
| 197 |
document is in the DocBook format or the LinuxDoc format or the
|
| 198 |
TEI format.</para>
|
| 199 |
</sect2>
|
| 200 |
|
| 201 |
<sect2>
|
| 202 |
<title>What does SGML look like?</title>
|
| 203 |
<para>SGML is a markup language. All SGML documents include
|
| 204 |
text, mixed with <emphasis>tags</emphasis>, which delimits
|
| 205 |
<emphasis>elements</emphasis><footnote><para>Depending on the DTD, the
|
| 206 |
end-tag can be mandatory or not. In XML, end-tags are always mandatory.</para>
|
| 207 |
</footnote>. SGML allows several syntaxes to be
|
| 208 |
used, but we'll stick with the reference syntax, the most
|
| 209 |
common, where tags are enclosed between angle brackets, < and
|
| 210 |
>. Here is an example:</para>
|
| 211 |
<programlisting role="docbook">
|
| 212 |
<![CDATA[
|
| 213 |
<article>
|
| 214 |
|
| 215 |
<title>The Foo software</title>
|
| 216 |
|
| 217 |
<para>
|
| 218 |
Foo is very fast. And its documentation can be read easily.
|
| 219 |
</para>
|
| 220 |
]]>
|
| 221 |
</programlisting>
|
| 222 |
<para>If it looks like HTML to you, it is because HTML is
|
| 223 |
(theoretically) a DTD of SGML.</para>
|
| 224 |
<para>Elements have a <emphasis>content</emphasis>. For
|
| 225 |
instance, the content of the above <sgmltag>para</sgmltag>
|
| 226 |
element is "Foo is very fast.
|
| 227 |
And its documentation can be read easily.".</para>
|
| 228 |
<para>Elements can have <emphasis>attributes</emphasis> to
|
| 229 |
indicate more information. For instance:</para>
|
| 230 |
<programlisting role="docbook">
|
| 231 |
<![CDATA[
|
| 232 |
<example tested="true">
|
| 233 |
*c++;
|
| 234 |
</example>
|
| 235 |
]]>
|
| 236 |
</programlisting>
|
| 237 |
<para>You can have also <emphasis>entities</emphasis> which
|
| 238 |
allow you to parametrize some text. For instance, if you often
|
| 239 |
refer to "the Best Operating System, Debian" and you want to
|
| 240 |
avoid typing it each time or, worse, having to change every
|
| 241 |
occurrence if you finally decide a more modest wording, you
|
| 242 |
can declare an entity, let's call it "debian" and use it with
|
| 243 |
the ampersand "&debian;"<footnote><para>This is
|
| 244 |
<emphasis>reference entities</emphasis>. SGML use other types
|
| 245 |
of entities, which are not covered in this HOWTO.</para></footnote>.</para>
|
| 246 |
<para> One element is special: the <emphasis>root
|
| 247 |
element</emphasis> is the global element, which contains
|
| 248 |
everything. In XML, the DOCTYPE line indicates which element
|
| 249 |
is the root. Here is an example<phrase debianversionequal="2.2"> (It
|
| 250 |
seems <emphasis>there is a bug</emphasis> in the SGML environment of Debian 2.2,
|
| 251 |
which requires a full path name for the DTD below. If so,
|
| 252 |
this is a bug and I will investigate it<comment>TODO: do
|
| 253 |
it, a bug against psgml has been filled. Follow it.</comment>)</phrase>:</para>
|
| 254 |
<programlisting role="docbook">
|
| 255 |
<![CDATA[
|
| 256 |
<!DOCTYPE article PUBLIC "-//Norman Walsh//DTD DocBk XML V3.1//EN"
|
| 257 |
"dtd/docbook-xml/docbookx.dtd"[
|
| 258 |
]]>
|
| 259 |
</programlisting>
|
| 260 |
<sect3><title>And the XML files?</title>
|
| 261 |
<para>You'll learn <link linkend="xml">later about
|
| 262 |
XML</link>. Let's just say that XML files begin first with a
|
| 263 |
<emphasis>processing instruction</emphasis>, which starts with
|
| 264 |
<? and, in that case indicates it is a XML file, as well as
|
| 265 |
some meta-information. Example:</para>
|
| 266 |
<programlisting role="docbook">
|
| 267 |
<![CDATA[
|
| 268 |
<?xml version="1.0" encoding="utf-8"?>
|
| 269 |
]]>
|
| 270 |
</programlisting>
|
| 271 |
<para>XML files must be <emphasis>well-formed</emphasis>,
|
| 272 |
which means that tags must be balanced (no crossing of tags
|
| 273 |
which is common in the HTML output of many Web editors) and
|
| 274 |
can be <emphasis>valid</emphasis> which means conformant to
|
| 275 |
their DTD.</para>
|
| 276 |
<para>Start-tags must always have an end-tag in XML, but you
|
| 277 |
can have <emphasis>empty elements</emphasis> where the
|
| 278 |
start-tag and the end-tag merge in a tag written with a / at
|
| 279 |
the end like:</para>
|
| 280 |
<programlisting role="xml">
|
| 281 |
<![CDATA[
|
| 282 |
<foobar/>
|
| 283 |
]]>
|
| 284 |
</programlisting>
|
| 285 |
</sect3>
|
| 286 |
</sect2>
|
| 287 |
|
| 288 |
<sect2>
|
| 289 |
<title>What is a DTD?</title>
|
| 290 |
<para>A Document Type Definition is the description (in SGML)
|
| 291 |
of a specific language. You can write your own DTD (it is not
|
| 292 |
very difficult, especially in XML) or you can use an
|
| 293 |
already-existing DTD, which is convenient if you want to
|
| 294 |
exchange documents with other people. Several such DTDs exist,
|
| 295 |
typically for the purposes of a given group of people (astronoms, chemists, scholars in ancient literature...).</para>
|
| 296 |
<para>The DTD lists the allowed elements and their
|
| 297 |
relationships (for instance, it says a <sgmltag>chapter</sgmltag>
|
| 298 |
must have at least one <sgmltag>section</sgmltag>).</para>
|
| 299 |
<para>Typical DTDs that you may find useful:</para>
|
| 300 |
<itemizedlist>
|
| 301 |
<listitem>
|
| 302 |
<para><ulink url="http://www.oasis-open.org/docbook/">DocBook</ulink> is mostly intended for
|
| 303 |
writing technical documentation, especially about software.</para>
|
| 304 |
</listitem>
|
| 305 |
<listitem>
|
| 306 |
<para><ulink url="http://www.linuxdoc.org/">LinuxDoc</ulink>
|
| 307 |
is used by the Linux Documentation Project, for instance for
|
| 308 |
the Linux
|
| 309 |
HOWTOs. The LDP has decided to switch to DocBook, but the
|
| 310 |
conversion has not been carried out.</para>
|
| 311 |
</listitem>
|
| 312 |
<listitem>
|
| 313 |
<para><ulink url="http://www.debian.org/~elphick/ddp/manuals.html#doc">DebianDoc</ulink> is used in part by the
|
| 314 |
<ulink url="http://www.debian.org/~elphick/ddp/">Debian Documentation Project</ulink>.</para>
|
| 315 |
</listitem>
|
| 316 |
<listitem>
|
| 317 |
<para><ulink url="http://www.w3.org/MarkUp/">HTML</ulink> is
|
| 318 |
in theory an SGML DTD but
|
| 319 |
very few actual Web pages are compliant. So, most SGML tools
|
| 320 |
will choke on a typical Web page.</para>
|
| 321 |
</listitem>
|
| 322 |
</itemizedlist>
|
| 323 |
<para>At the beginning of a document, you will find a
|
| 324 |
reference to the DTD to use (there are several ways to indicate
|
| 325 |
such references; the following example is for LinuxDoc):</para>
|
| 326 |
<programlisting role="linuxdoc">
|
| 327 |
<![CDATA[
|
| 328 |
<!doctype linuxdoc system>
|
| 329 |
|
| 330 |
<article>
|
| 331 |
|
| 332 |
<title>The Linux Kernel HOWTO
|
| 333 |
]]>
|
| 334 |
</programlisting>
|
| 335 |
<comment>TODO: Explain FPI, PUBLIC and SYSTEM, etc.</comment>
|
| 336 |
</sect2>
|
| 337 |
|
| 338 |
<sect2>
|
| 339 |
<title>Which DTD to choose?</title>
|
| 340 |
<para>Very often, you'll have no choice: the project you're a
|
| 341 |
part of will have chosen already. Since standardization is of
|
| 342 |
course very important in a big project, there is little chance
|
| 343 |
you'll be able to change that. For instance, Linux Documentation
|
| 344 |
Project uses LinuxDoc, <ulink
|
| 345 |
url="http://www.freebsd.org/docproj/docproj.html">FreeBSD</ulink>,
|
| 346 |
<ulink url="http://developer.gnome.org/arch/doc/tools.html">GNOME</ulink> or <ulink
|
| 347 |
url="http://www.kde.org/documentation/index.html">KDE</ulink> use DocBook, etc.</para>
|
| 348 |
<para>If you have the choice, I suggest to stay close to what
|
| 349 |
similar projects are doing. If you write technical documentation
|
| 350 |
for computer hardware or software, this probably means using
|
| 351 |
DocBook.</para>
|
| 352 |
</sect2>
|
| 353 |
|
| 354 |
<sect2>
|
| 355 |
<title>How do I write SGML?</title>
|
| 356 |
<para>Since SGML is a markup language, you can use any editor,
|
| 357 |
like <application>vi</application> or even
|
| 358 |
<application>cat</application>.</para>
|
| 359 |
<para>But it is often easier with an editor which helps you
|
| 360 |
inserting tags, knowing, for example, which are valid. I recommend
|
| 361 |
<application>Emacs</application> with its <link linkend="psgml">SGML mode</link>.</para>
|
| 362 |
</sect2>
|
| 363 |
|
| 364 |
<sect2 id="xml">
|
| 365 |
<title>What is XML?</title>
|
| 366 |
<para>XML (Extensible Markup Language ) is a subset of SGML, a
|
| 367 |
sort of SGML--. It
|
| 368 |
was designed first for the World-Wide Web, but it is now used
|
| 369 |
in unrelated areas.</para>
|
| 370 |
<para>XML is much simpler than SGML, with less options, so a parser is
|
| 371 |
lighter and faster.</para>
|
| 372 |
</sect2>
|
| 373 |
|
| 374 |
<sect2>
|
| 375 |
<title>What is a stylesheet?</title>
|
| 376 |
<para>In the markup world, you try to separate content from
|
| 377 |
presentation. Content is expressed in the SGML document,
|
| 378 |
following a given DTD. Presentation is expressed outside of the
|
| 379 |
document, typically in a DTD-specific stylesheet, which is a description, in an
|
| 380 |
appropriate language (<ulink
|
| 381 |
url="http://www.jclark.com/dsssl/">DSSSL
|
| 382 |
</ulink> - Document Style Semantics and
|
| 383 |
Specification Language - is the most common<footnote><para>The
|
| 384 |
XML world created a new language, <ulink
|
| 385 |
url="http://www.w3.org/Style/XSL/">XSL</ulink>, which has few
|
| 386 |
implementations at this moment<phrase debianversionmax="2.1">
|
| 387 |
(and none before Debian 2.2)</phrase>.
|
| 388 |
Despite what you may read in executive
|
| 389 |
summaries, it is perfectly acceptable to use DSSSL to render XML
|
| 390 |
files.</para></footnote>),
|
| 391 |
of the layout rules for documents written for a certain DTD.</para>
|
| 392 |
<para>For instance, it is the author of the stylesheet who will
|
| 393 |
decide that titles should be rendered in bold, that URLs will be
|
| 394 |
printed in red, etc.</para>
|
| 395 |
<para>If you know the <ulink url="http://www.w3.org/Style/CSS/">
|
| 396 |
CSS</ulink> (Cascading
|
| 397 |
Style Sheets) language, do note that typical languages for SGML
|
| 398 |
stylesheets are more complicated: they allow not only to specify
|
| 399 |
the rendering of an element, but also the reordering of elements,
|
| 400 |
computation of data from some elements, etc. DSSSL, for instance, is a
|
| 401 |
full blown programming language (based on Scheme), enriched with stylesheet
|
| 402 |
constructs.</para>
|
| 403 |
</sect2>
|
| 404 |
|
| 405 |
</sect1>
|
| 406 |
|
| 407 |
<sect1>
|
| 408 |
<title>Creating documentation with DocBook</title>
|
| 409 |
<para>Here, we will see how to write and process documentation,
|
| 410 |
using the DocBook DTD. We will use the XML version, often named
|
| 411 |
DocBk, because
|
| 412 |
I prefer XML<footnote><para>And also because future versions of
|
| 413 |
DocBook will be <ulink url="http://www.oasis-open.org/docbook/meetings/min19990308.html">XML</ulink>.</para></footnote>, but most of what is written here apply to the SGML
|
| 414 |
version as well.</para>
|
| 415 |
<para debianversionmax="2.1">To use it on a Debian system prior to
|
| 416 |
2.2 'potato', you'll need the
|
| 417 |
<debianpackage>docbook-xml</debianpackage>. It installs fine on a
|
| 418 |
'slink' system and does not break anything (it is just a DTD, it
|
| 419 |
does not depend on specific libraries).</para>
|
| 420 |
<sect2>
|
| 421 |
<title>Writing DocBook</title>
|
| 422 |
<para>You can skip this section if you just received a DocBook
|
| 423 |
file and want to process it, rather than edit it.</para>
|
| 424 |
<para>Like with any DTD, I recommend &psgml; to write DocBook. </para>
|
| 425 |
<para>First, choose a root element, preferably the simplest,
|
| 426 |
<sgmltag>article</sgmltag>. Start with:</para>
|
| 427 |
<programlisting role="docbook">
|
| 428 |
<![CDATA[
|
| 429 |
<?xml version="1.0"?>
|
| 430 |
<!DOCTYPE article PUBLIC "-//Norman Walsh//DTD DocBk XML V3.1//EN"
|
| 431 |
"dtd/docbook-xml/docbookx.dtd">
|
| 432 |
<article>
|
| 433 |
<artheader>
|
| 434 |
<title>My first XML document</title>
|
| 435 |
</artheader>
|
| 436 |
<section>
|
| 437 |
<title>My first section</title>
|
| 438 |
<para>My first paragraph.</para>
|
| 439 |
</section>
|
| 440 |
</article>
|
| 441 |
]]>
|
| 442 |
</programlisting>
|
| 443 |
<para>This is a complete DocBook document. You can <link linkend="nsgmls">
|
| 444 |
validate it</link><footnote><para>Just ignore the warning <programlisting role="nsgmls">/usr/lib/sgml/declaration/xml.decl:1:W: SGML declaration was not implied</programlisting></para>
|
| 445 |
</footnote>.</para>
|
| 446 |
<para>Typical DocBook documents use book, chapter or article as the
|
| 447 |
root element. Then, they include a header, where you find meta-information,
|
| 448 |
such as the title of the document. After this header, a DocBook
|
| 449 |
document is divided into sections, each with a title.
|
| 450 |
<comment>More details would be nice.</comment>
|
| 451 |
</para>
|
| 452 |
<para>To know the complete list of elements, see
|
| 453 |
<debiandoc text="the set of DocBook texts">docbook-doc</debiandoc>, more specially
|
| 454 |
<debiandoc file="r2333.html" text="DocBook DTD Reference">docbook-doc</debiandoc>.</para>
|
| 455 |
</sect2>
|
| 456 |
|
| 457 |
<sect2>
|
| 458 |
<title>Processing DocBook documents</title>
|
| 459 |
<para>Remember, DocBook is not a program but a format. Asking
|
| 460 |
"Does DocBook have a PDF output?" is meaningless. Software which
|
| 461 |
uses DocBook may produce PDF. DocBook itself does nothing.</para>
|
| 462 |
<para>There are several different solutions to produce printed
|
| 463 |
paper, Web pages or manual pages from DocBook documents. You could
|
| 464 |
program such a transformation yourself with tools like the Perl module
|
| 465 |
XML::Parser or the Java module XP. Or you can use stylesheets,
|
| 466 |
which you may or may not write yourself. If you decide not to
|
| 467 |
write them, you can use
|
| 468 |
the &modular_ss; with &jade;.</para>
|
| 469 |
<para>Since we are using the XML version of DocBook, here is how to
|
| 470 |
call &jade; to translate <filename>myfile.db</filename> to TeX:</para>
|
| 471 |
<programlisting role="shell">
|
| 472 |
jade -t tex -V tex-backend \
|
| 473 |
-d &print_ss; \
|
| 474 |
&xml_decl; myfile.db
|
| 475 |
</programlisting>
|
| 476 |
<para>which will produce a TeX file using &jadetex; macros and
|
| 477 |
needing the &jadetex; program to be processed:</para>
|
| 478 |
<programlisting role="shell">
|
| 479 |
jadetex myfile.tex
|
| 480 |
</programlisting>
|
| 481 |
<para>And to HTML:</para>
|
| 482 |
<programlisting role="shell">
|
| 483 |
jade -t sgml \
|
| 484 |
-d &html_ss; \
|
| 485 |
&xml_decl; myfile.db
|
| 486 |
</programlisting>
|
| 487 |
<para>Unfortunately, there is no easy way to create text-only
|
| 488 |
output from a DocBook file, for instance for posting it on
|
| 489 |
Usenet. The best available solution is to use the following
|
| 490 |
kluge with
|
| 491 |
<application>lynx<comment
|
| 492 |
debianversionmin="2.2">w3m could be used but it misses the
|
| 493 |
display or the URLs. You can use the scripts in examples/ like
|
| 494 |
htmldump. Something to check.</comment></application>:</para>
|
| 495 |
<programlisting role="shell">
|
| 496 |
jade -t sgml -V nochunks \
|
| 497 |
-d &html_ss; \
|
| 498 |
&xml_decl; myfile.db > dump.html
|
| 499 |
lynx -force_html -dump dump.html > myfile.txt
|
| 500 |
<comment debianversionmin="2.2">w3m -dump dump.html > myfile.txt</comment>
|
| 501 |
</programlisting>
|
| 502 |
<sect3 debianversionmin="2.2"><title>Using SGMLtools</title>
|
| 503 |
<para>You can also use &sgmltools2;. This may be
|
| 504 |
simpler, since &sgmltools2; automates the tasks performed by
|
| 505 |
jade, jadetex and lynx. But it does <emphasis>not</emphasis> work with the XML
|
| 506 |
version of DocBook. To convert a file to HTML:</para>
|
| 507 |
<programlisting role="shell">
|
| 508 |
sgmltools --backend=html howto.db
|
| 509 |
</programlisting>
|
| 510 |
<para>And to PostScript:</para>
|
| 511 |
<programlisting role="shell">
|
| 512 |
sgmltools --backend=ps howto.db
|
| 513 |
</programlisting>
|
| 514 |
<para>And to pure text:</para>
|
| 515 |
<programlisting role="shell">
|
| 516 |
sgmltools --backend=txt howto.db
|
| 517 |
</programlisting>
|
| 518 |
</sect3>
|
| 519 |
<sect3><title>Automatize it with <application>make</application></title>
|
| 520 |
<para>Since the manipulations needed to convert from
|
| 521 |
DocBook to anything can be complicated, the use of
|
| 522 |
<application>make</application>
|
| 523 |
is recommended. An example of a <filename>Makefile</filename> is:</para>
|
| 524 |
<programlisting role="makefile">
|
| 525 |
<![CDATA[
|
| 526 |
MAX_TEX_RECURSION=4
|
| 527 |
XML_DECL=/usr/lib/sgml/declaration/xml.decl
|
| 528 |
HTML_SS=/usr/lib/sgml/stylesheet/dsssl/docbook/nwalsh/html/docbook.dsl
|
| 529 |
PRINT_SS=/usr/lib/sgml/stylesheet/dsssl/docbook/nwalsh/print/docbook.dsl
|
| 530 |
|
| 531 |
all: myfile
|
| 532 |
|
| 533 |
myfile: myfile.ps myfile.txt myfile.html
|
| 534 |
|
| 535 |
myfile.tex: myfile.db
|
| 536 |
jade -t tex -V tex-backend \
|
| 537 |
-d $(PRINT_SS) \
|
| 538 |
$(XML_DECL) $<
|
| 539 |
|
| 540 |
myfile.dvi: myfile.tex
|
| 541 |
# Trick from Adam Di Carlo <adam@onshore.com> to recurse jadetex
|
| 542 |
# "just enough".
|
| 543 |
-cp -pf prior.aux pprior.aux
|
| 544 |
-cp -pf $(shell basename $< .tex).aux prior.aux
|
| 545 |
jadetex $<
|
| 546 |
if ! cmp $(shell basename $< .tex).aux prior.aux && \
|
| 547 |
! cmp $(shell basename $< .tex).aux pprior.aux && \
|
| 548 |
expr $(MAKELEVEL) '<' $(MAX_TEX_RECURSION); then \
|
| 549 |
rm -f $@ ;\
|
| 550 |
$(MAKE) $@ ;\
|
| 551 |
fi
|
| 552 |
rm -f prior.aux pprior.aux
|
| 553 |
|
| 554 |
myfile.ps: myfile.dvi
|
| 555 |
dvips -f $< > $@
|
| 556 |
|
| 557 |
myfile.html: myfile.db html.dsl
|
| 558 |
jade -t sgml \
|
| 559 |
-d $(HTML_SS) \
|
| 560 |
$(XML_DECL) $<
|
| 561 |
|
| 562 |
myfile.txt: myfile.db
|
| 563 |
jade -t sgml -V nochunks \
|
| 564 |
-d $(HTML_SS) \
|
| 565 |
$(XML_DECL) $< > dump.html
|
| 566 |
lynx -force_html -dump dump.html > $@
|
| 567 |
-rm -f dump.html
|
| 568 |
|
| 569 |
validate:
|
| 570 |
nsgmls -s -wxml $(XML_DECL) myfile.db
|
| 571 |
|
| 572 |
clean:
|
| 573 |
rm -f *.html *.aux *.log *.dvi *.ps *.tex *.txt
|
| 574 |
]]>
|
| 575 |
</programlisting>
|
| 576 |
</sect3>
|
| 577 |
|
| 578 |
<sect3>
|
| 579 |
<title>Localization (l10n) of the output</title>
|
| 580 |
<para>Localization (often written l10n to save space) is the
|
| 581 |
adaptation to a different language. Let's take French (whose
|
| 582 |
ISO code is "fr") as an example: DocBook can be l10n'ed for
|
| 583 |
other languages (see
|
| 584 |
<filename>/usr/lib/sgml/stylesheet/dsssl/docbook/nwalsh/common/dbl1*</filename>
|
| 585 |
for a list).</para>
|
| 586 |
<para debianversionmin="2.2">With the XML version, you have two ways to tell the
|
| 587 |
language:
|
| 588 |
<orderedlist>
|
| 589 |
<listitem>
|
| 590 |
<para>Using the <sgmltag class="attribute">lang</sgmltag>
|
| 591 |
attribute.
|
| 592 |
<comment>http://nwalsh.com/docbook/dsssl/doc/custom.html#AEN190
|
| 593 |
seems wrong.</comment>
|
| 594 |
|
| 595 |
<programlisting role="docbook">
|
| 596 |
<![CDATA[
|
| 597 |
<article lang="fr">
|
| 598 |
]]>
|
| 599 |
</programlisting>
|
| 600 |
And you will get labels ("Table of contents", "Next", "Previous", etc)
|
| 601 |
in French.</para>
|
| 602 |
</listitem>
|
| 603 |
<listitem>
|
| 604 |
<para>In the <link linkend="customdbss">custom stylesheet</link>:
|
| 605 |
<programlisting role="dsssl">
|
| 606 |
(define %default-language% "fr")
|
| 607 |
</programlisting>
|
| 608 |
</para>
|
| 609 |
</listitem>
|
| 610 |
</orderedlist></para>
|
| 611 |
<para debianversionmax="2.1">
|
| 612 |
<comment>The lang attribute seems ignored in slink's software?</comment>
|
| 613 |
You can set the language in the
|
| 614 |
<link linkend="customdbss">custom stylesheet</link>:
|
| 615 |
<programlisting role="dsssl">
|
| 616 |
(define %default-language% "fr")
|
| 617 |
</programlisting>
|
| 618 |
which will get you labels ("Table of contents", "Next", "Previous", etc)
|
| 619 |
in French.</para>
|
| 620 |
<para>It is not a complete l10n: hyphenation in the TeX output
|
| 621 |
will not be correct, for instance.</para>
|
| 622 |
<para debianversionmax="2.1">A bug in the packages in the
|
| 623 |
"slink" version will produce jadetex warnings:
|
| 624 |
<programlisting role="jadetex">
|
| 625 |
l.101 \select@language{francais}
|
| 626 |
|
| 627 |
|
| 628 |
! Package babel Error: You haven't defined the language francais yet.
|
| 629 |
|
| 630 |
See the babel package documentation for explanation.
|
| 631 |
</programlisting>
|
| 632 |
which you can ignore.</para>
|
| 633 |
</sect3>
|
| 634 |
|
| 635 |
<sect3 debianversionmin="2.2"><title>Misc</title>
|
| 636 |
<para>To convert DocBook to man pages or other formats, see <debianpackage name="docbook2X"
|
| 637 |
refserver="http://shell.ipoline.com/~elmert/hacks/docbook2X/">docbook2man</debianpackage>
|
| 638 |
and <debianpackage>docbook-to-man-ans</debianpackage>.
|
| 639 |
</para>
|
| 640 |
</sect3>
|
| 641 |
<sect3 id="customdbss">
|
| 642 |
<title>Customizing the Modular DocBook Stylesheets</title>
|
| 643 |
<para>If you <link linkend="customdb">write a custom
|
| 644 |
element</link>
|
| 645 |
or if you want to change the default rendering of
|
| 646 |
an element or if you simply want to customize the output a bit
|
| 647 |
(such as changing the default font), you'll have to define a
|
| 648 |
custom stylesheet. This does not imply retyping everything.
|
| 649 |
DSSSL allows one stylesheet to "use" another. The stylesheet
|
| 650 |
inherits all of the properties of the stylesheet that it is
|
| 651 |
using, but local definitions take precedence over imported ones.
|
| 652 |
An example of a custom stylesheet is:</para>
|
| 653 |
|
| 654 |
<programlisting role="dsssl">
|
| 655 |
<![CDATA[
|
| 656 |
|
| 657 |
<!DOCTYPE style-sheet PUBLIC "-//James Clark//DTD DSSSL Style Sheet//EN" [
|
| 658 |
<!ENTITY docbook.dsl
|
| 659 |
PUBLIC "-//Norman Walsh//DOCUMENT DocBook Print Stylesheet//EN"
|
| 660 |
CDATA DSSSL>
|
| 661 |
]>
|
| 662 |
|
| 663 |
<style-sheet>
|
| 664 |
<style-specification use="docbook">
|
| 665 |
<style-specification-body>
|
| 666 |
|
| 667 |
(define %body-font-family%
|
| 668 |
;; The font family used in body text
|
| 669 |
"Palatino")
|
| 670 |
|
| 671 |
</style-specification-body>
|
| 672 |
</style-specification>
|
| 673 |
|
| 674 |
<external-specification id="docbook" document="docbook.dsl">
|
| 675 |
|
| 676 |
</style-sheet>
|
| 677 |
]]>
|
| 678 |
</programlisting>
|
| 679 |
<para>Your style instructions (here the changing of the font
|
| 680 |
to Palatino) have to be written in DSSSL, whose syntax and
|
| 681 |
many semantics come from the programming language Scheme,
|
| 682 |
which is itself a Lisp dialect. You do not need to learn
|
| 683 |
Scheme, the <phrase debianversionmax="2.1"><debiandoc text="documentation of the Modular Stylesheets" file="doc/custom.html">docbook-stylesheets</debiandoc></phrase><phrase debianversionmin="2.2"><debiandoc text="documentation of the Modular Stylesheets" file="custom.html">docbook-stylesheets-doc</debiandoc></phrase>
|
| 684 |
contains examples for most purposes.</para>
|
| 685 |
<para>Since there are actually two stylesheets, one for printing and
|
| 686 |
one for HTML, the above custom stylesheet works only for the
|
| 687 |
first one. For the second, here is an exemple:</para>
|
| 688 |
<programlisting role="dsssl">
|
| 689 |
<![CDATA[
|
| 690 |
<!DOCTYPE style-sheet PUBLIC "-//James Clark//DTD DSSSL Style Sheet//EN" [
|
| 691 |
<!ENTITY docbook.dsl PUBLIC "-//Norman Walsh//DOCUMENT DocBook HTML Stylesheet//EN" CDATA dsssl>
|
| 692 |
]>
|
| 693 |
<style-sheet>
|
| 694 |
|
| 695 |
<style-specification id="html" use="docbook">
|
| 696 |
<style-specification-body>
|
| 697 |
|
| 698 |
(define %generate-article-titlepage% #t)
|
| 699 |
|
| 700 |
</style-specification-body>
|
| 701 |
</style-specification>
|
| 702 |
|
| 703 |
<external-specification id="docbook" document="docbook.dsl">
|
| 704 |
|
| 705 |
</style-sheet>
|
| 706 |
]]>
|
| 707 |
</programlisting>
|
| 708 |
<para>In both cases, you'll have to tell Jade to use your
|
| 709 |
stylesheets, here <filename>myprint.dsl</filename>:</para>
|
| 710 |
<programlisting role="shell">
|
| 711 |
jade -t tex -V tex-backend \
|
| 712 |
-d myprint.dsl \
|
| 713 |
&xml_decl; myfile.db
|
| 714 |
</programlisting>
|
| 715 |
|
| 716 |
</sect3>
|
| 717 |
<sect3 id="customdb"><title>Customizing the DocBook DTD</title>
|
| 718 |
<para>
|
| 719 |
DocBook is intended to be customizable. There are many ways
|
| 720 |
to do that<footnote><para>Including copying the DTD and
|
| 721 |
editing it... But I was referring to `clean' ways of modifying the
|
| 722 |
DTD, which will not create too many problems with
|
| 723 |
future versions of DocBook.</para></footnote>,
|
| 724 |
but be careful: customization may lead to problems
|
| 725 |
when exchanging documents with others. See <debiandoc
|
| 726 |
text="Customizer's Guide for the DocBook DTD" file="book68527.html">docbook-doc</debiandoc>.
|
| 727 |
</para>
|
| 728 |
<para>If you add new elements, you'll probably have to
|
| 729 |
create a custom stylesheet as well.</para>
|
| 730 |
<comment>
|
| 731 |
Give examples of customization.
|
| 732 |
</comment>
|
| 733 |
</sect3>
|
| 734 |
|
| 735 |
</sect2>
|
| 736 |
|
| 737 |
</sect1>
|
| 738 |
|
| 739 |
<sect1>
|
| 740 |
<title>Creating documentation with LinuxDoc</title>
|
| 741 |
<para>We will now go into writing and processing documentation
|
| 742 |
using the LinuxDoc DTD.</para>
|
| 743 |
<sect2>
|
| 744 |
<title>Writing LinuxDoc</title>
|
| 745 |
<para>You can skip this section if you just received a LinuxDoc
|
| 746 |
file (for instance one of the Linux HOWTOs, such as you can find in the
|
| 747 |
<ulink
|
| 748 |
url="http://metalab.unc.edu/pub/Linux/docs/HOWTO/other-formats/sgml/">
|
| 749 |
LinuxDoc servers</ulink>).</para>
|
| 750 |
<para>You may write LinuxDoc documents with &psgml;. Here is a
|
| 751 |
sample example:</para>
|
| 752 |
<programlisting role="linuxdoc">
|
| 753 |
<![CDATA[
|
| 754 |
<!doctype linuxdoc system>
|
| 755 |
<article>
|
| 756 |
|
| 757 |
<title>Quick SGML Example
|
| 758 |
<author>Matt Welsh, <tt>mdw@cs.cornell.edu</tt>
|
| 759 |
<date>v1.0, 28 March 1994
|
| 760 |
<abstract>
|
| 761 |
This document is a brief example using the Linuxdoc-SGML DTD.
|
| 762 |
</abstract>
|
| 763 |
|
| 764 |
<sect>Introduction
|
| 765 |
|
| 766 |
<p>
|
| 767 |
This is an SGML example file using the Linuxdoc-SGML DTD.
|
| 768 |
|
| 769 |
</article>
|
| 770 |
]]>
|
| 771 |
</programlisting>
|
| 772 |
<para>A more complete example of a LinuxDoc document is <debiandoc file="example.sgml.gz">sgml-tools</debiandoc>.</para>
|
| 773 |
<para>To learn the list of legal elements, see <debiandoc
|
| 774 |
file="html/guide.html.gz">sgml-tools</debiandoc><phrase
|
| 775 |
debianversionmax="2.1"> (it is currently buggy: the HTML files
|
| 776 |
are compressed, which may harm your browser) </phrase>or see <ulink
|
| 777 |
url="http://www.sgmltools.org/guide/guide.html">Matt Welsh's guide</ulink>.</para>
|
| 778 |
</sect2>
|
| 779 |
<sect2>
|
| 780 |
<title>Processing LinuxDoc</title>
|
| 781 |
<para>You will use &sgmltools1;. To convert a
|
| 782 |
LinuxDoc document to HTML:</para>
|
| 783 |
<programlisting role="shell">
|
| 784 |
sgml2html document.sgml
|
| 785 |
</programlisting>
|
| 786 |
<para>To ordinary text, for instance to post it on the News:</para>
|
| 787 |
<programlisting role="shell">
|
| 788 |
sgml2txt document.sgml
|
| 789 |
</programlisting>
|
| 790 |
<para>And to PostScript, using LaTeX:</para>
|
| 791 |
<programlisting role="shell">
|
| 792 |
sgml2latex --output=ps document.sgml
|
| 793 |
</programlisting>
|
| 794 |
<comment>
|
| 795 |
The extension has to be .sgml or sgml-tools will do unproper
|
| 796 |
things.
|
| 797 |
</comment >
|
| 798 |
<para>You can have more information in <phrase
|
| 799 |
debianversionmax="2.1">sgmltools(1)</phrase><phrase debianversionmin="2.2">sgmltools.v1(1)</phrase>.</para>
|
| 800 |
<comment>TODO: localization un various languages.</comment>
|
| 801 |
</sect2>
|
| 802 |
|
| 803 |
</sect1>
|
| 804 |
|
| 805 |
<sect1>
|
| 806 |
<title>Creating documentation with DebianDoc</title>
|
| 807 |
<para>Here, we will see how to write and process documentation,
|
| 808 |
using the DebianDoc DTD.</para>
|
| 809 |
<sect2><title>Writing DebianDoc documents</title>
|
| 810 |
<para>Here is a sample DebianDoc document:</para>
|
| 811 |
<programlisting role="debiandoc">
|
| 812 |
<![CDATA[
|
| 813 |
<!doctype debiandoc public "-//DebianDoc//DTD DebianDoc//EN">
|
| 814 |
|
| 815 |
<debiandoc>
|
| 816 |
<book>
|
| 817 |
<titlepag>
|
| 818 |
<title>FooBar</title>
|
| 819 |
<author>
|
| 820 |
<name>Bortzmeyer</name>
|
| 821 |
<email>bortzmeyer@debian.org</email>
|
| 822 |
</author>
|
| 823 |
</titlepag>
|
| 824 |
<chapt>
|
| 825 |
<heading>Title</heading>
|
| 826 |
<p>Content</p>
|
| 827 |
</chapt>
|
| 828 |
</book>
|
| 829 |
</debiandoc>
|
| 830 |
]]>
|
| 831 |
</programlisting>
|
| 832 |
<para>To know the list of legal tags, see <phrase
|
| 833 |
debianversionmax="2.1">
|
| 834 |
<debiandoc
|
| 835 |
file="debiandoc-sgml.html/index.html">debiandoc-sgml</debiandoc>
|
| 836 |
</phrase>
|
| 837 |
<phrase debianversionmin="2.2"><debiandoc
|
| 838 |
file="debiandoc-sgml.html/index.html">debiandoc-sgml-doc</debiandoc>
|
| 839 |
<comment>Bug #47300</comment></phrase>.</para>
|
| 840 |
</sect2>
|
| 841 |
<sect2><title>Processing DebianDoc documents</title>
|
| 842 |
<para>
|
| 843 |
To translate to PostScript:
|
| 844 |
</para>
|
| 845 |
<programlisting role="shell">
|
| 846 |
debiandoc2ps -1 myfile.dd
|
| 847 |
</programlisting>
|
| 848 |
<para>And to HTML:</para>
|
| 849 |
<programlisting role="shell">
|
| 850 |
debiandoc2html myfile.dd
|
| 851 |
</programlisting>
|
| 852 |
</sect2>
|
| 853 |
|
| 854 |
</sect1>
|
| 855 |
|
| 856 |
<sect1>
|
| 857 |
<title>Tools</title>
|
| 858 |
<para>This section is no longer oriented toward tasks, but toward
|
| 859 |
software that you can use to write and process SGML.</para>
|
| 860 |
<para debianversionmin="2.2"> The simplest way to
|
| 861 |
get all these tools is to install
|
| 862 |
<debianpackage>task-sgml</debianpackage>.</para>
|
| 863 |
<para debianversionmax="2.1"> To get all these tools, you'll have to
|
| 864 |
install several packages. Here is the
|
| 865 |
<application>apt</application> command which will do it for
|
| 866 |
you<footnote><para>Providing that <application>apt</application>
|
| 867 |
has been configured properly before.</para></footnote>:
|
| 868 |
<programlisting role="shell">
|
| 869 |
apt-get install docbook docbook-doc sp jade \
|
| 870 |
docbook-stylesheets jadetex debiandoc-sgml \
|
| 871 |
psgml
|
| 872 |
</programlisting>
|
| 873 |
</para>
|
| 874 |
<sect2 id="psgml">
|
| 875 |
<title><debianpackage name="psgml" refserver="http://www.lysator.liu.se/projects/about_psgml.html">PSGML</debianpackage></title>
|
| 876 |
<para>An excellent SGML mode for Emacs. Among its many features,
|
| 877 |
it can:</para>
|
| 878 |
<itemizedlist>
|
| 879 |
<listitem><para>Show you what tags are valid at a given point,</para>
|
| 880 |
</listitem>
|
| 881 |
<listitem><para>Insert tags (begin and end, as well as
|
| 882 |
mandatory tags in between) from a menu which shows only valid
|
| 883 |
tags (this is tremendously useful when you start to use a new
|
| 884 |
and complicated DTD),</para>
|
| 885 |
</listitem>
|
| 886 |
<listitem><para>Manipulate SGML elements, move
|
| 887 |
according to elements, etc.</para>
|
| 888 |
</listitem>
|
| 889 |
</itemizedlist>
|
| 890 |
<para>Its documentation is in <debiandoc
|
| 891 |
file="psgml_toc.html">psgml</debiandoc>.</para>
|
| 892 |
<para>
|
| 893 |
Having some options set up in your <filename>~/.emacs</filename> will
|
| 894 |
ease your use of psgml. Here are some examples:</para>
|
| 895 |
<programlisting role="emacs-lisp">
|
| 896 |
<![CDATA[
|
| 897 |
(autoload 'xml-mode "psgml" "Major mode to edit XML files." t )
|
| 898 |
|
| 899 |
(setq
|
| 900 |
auto-mode-alist (append '(
|
| 901 |
;; DocBook-XML
|
| 902 |
("\\.db" . xml-mode)
|
| 903 |
)
|
| 904 |
auto-mode-alist))
|
| 905 |
|
| 906 |
(add-hook 'sgml-mode-hook 'turn-on-auto-fill)
|
| 907 |
(setq sgml-custom-dtd '(
|
| 908 |
( "HTML 4.0 Strict"
|
| 909 |
"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\"
|
| 910 |
\"dtd/html-4.0s.dtd\">" )
|
| 911 |
( "HTML 4.0 Blaireau"
|
| 912 |
"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML Transitional 4.0//EN\"
|
| 913 |
\"dtd/html-4.0-loose.dtd\">" )
|
| 914 |
( "DocBook 3.1 XML Article"
|
| 915 |
"<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>
|
| 916 |
<!DOCTYPE article PUBLIC \"-//Norman Walsh//DTD DocBk XML V3.1//EN\"
|
| 917 |
\"dtd/docbook-xml/docbookx.dtd\">" )
|
| 918 |
))
|
| 919 |
(setq sgml-insert-missing-element-comment nil)
|
| 920 |
]]>
|
| 921 |
</programlisting>
|
| 922 |
<para>Among the most useful psgml commands:
|
| 923 |
<itemizedlist>
|
| 924 |
<listitem><para>C-c C-t :
|
| 925 |
<command>sgml-list-valid-tags</command>
|
| 926 |
reminds you
|
| 927 |
(or teaches you) the DTD. Very convenient when you start
|
| 928 |
playing with a monster like DocBook.</para>
|
| 929 |
</listitem>
|
| 930 |
<listitem><para><command>sgml-insert-element</command>. Again, a great
|
| 931 |
way to learn a DTD</para>
|
| 932 |
</listitem>
|
| 933 |
</itemizedlist>
|
| 934 |
</para>
|
| 935 |
</sect2>
|
| 936 |
<sect2 id="nsgmls">
|
| 937 |
<title><debianpackage name="sp" refserver="http://www.jclark.com/sp/nsgmls.htm">nsgmls</debianpackage></title>
|
| 938 |
<para>An SGML tool, for instance for validating SGML documents. A
|
| 939 |
typical use is to check the validity of a document:</para>
|
| 940 |
<programlisting role="shell">
|
| 941 |
nsgmls -s file.sgml
|
| 942 |
</programlisting>
|
| 943 |
<para>This will check whether or not the contents of the file
|
| 944 |
<filename>file.sgml</filename> conform to the DTD indicated
|
| 945 |
in the header of the file.</para>
|
| 946 |
<para>If you write XML documents, two options of nsgmls are
|
| 947 |
necessary:</para>
|
| 948 |
<programlisting role="shell">
|
| 949 |
nsgmls -s -wxml &xml_decl; file.sgml
|
| 950 |
</programlisting>
|
| 951 |
<para>There is a <debiandoc
|
| 952 |
file="nsgmls.htm">sp</debiandoc>. nsgmls being a part of the
|
| 953 |
sp package, the <debiandoc file="index.htm">sp</debiandoc> for sp may be useful
|
| 954 |
too.</para>
|
| 955 |
</sect2>
|
| 956 |
<sect2 id="rxp" debianversionmin="2.2">
|
| 957 |
<title><debianpackage>rxp</debianpackage></title>
|
| 958 |
<para>A pure XML tool; can, for instance, be used to validate XML
|
| 959 |
documents.</para>
|
| 960 |
</sect2>
|
| 961 |
<sect2 id="jade">
|
| 962 |
<title><debianpackage
|
| 963 |
refserver="http://www.jclark.com/jade/">jade</debianpackage></title>
|
| 964 |
<comment>TODO: We should mention OpenJade! http://jade-cvs.avionitek.com/</comment>
|
| 965 |
<para>jade is a DSSSL
|
| 966 |
processor. It takes an SGML file and a
|
| 967 |
stylesheet, written in the DSSSL language, and produces output
|
| 968 |
in the TeX (for which PostScript can be made), RTF or HTML
|
| 969 |
formats.
|
| 970 |
It has
|
| 971 |
no backend for <application>groff</application> and therefore has trouble producing
|
| 972 |
ASCII. The <application>TeX</application> backend produces &jadetex; files.</para>
|
| 973 |
<para>The documentation is not really clear but it at leasts
|
| 974 |
tell you the various options. See <debiandoc file="jade.htm">jade</debiandoc>.</para>
|
| 975 |
<para>Typical uses:</para>
|
| 976 |
<programlisting role="shell">
|
| 977 |
jade -t backend-to-use -d stylesheet-name input-file
|
| 978 |
</programlisting>
|
| 979 |
</sect2>
|
| 980 |
<sect2 id="jadetex">
|
| 981 |
<title><debianpackage>jadetex</debianpackage></title>
|
| 982 |
<comment>http://www.tug.org/applications/jadetex/"</comment>
|
| 983 |
<para>A set of <application>TeX</application> macros to process
|
| 984 |
the output of jade. Poorly documented and difficult to
|
| 985 |
customize. Like with every TeX macros, several runs may be
|
| 986 |
necessary, in particular to resolve references.</para>
|
| 987 |
</sect2>
|
| 988 |
<sect2 id="sgmltools2" debianversionmin="2.2">
|
| 989 |
<title><debianpackage name="sgmltoolsv2" refserver="http://www.sgmltools.org/">SGMLtools</debianpackage></title>
|
| 990 |
<para>The SGMLtools exist in two versions, 1 and 2. SGMLtools is
|
| 991 |
the version 2.</para>
|
| 992 |
<para>Unlike sgml-tools, version 1, which processes LinuxDoc
|
| 993 |
documents, SGMLtools, version 2, treats DocBook
|
| 994 |
documents. You can do everything it does with direct calls
|
| 995 |
to &jade; but it may be simpler to use SGMLtools.</para>
|
| 996 |
</sect2>
|
| 997 |
<sect2 id="sgmltools1">
|
| 998 |
<title><debianpackage name="sgml-tools"
|
| 999 |
refserver="http://www.sgmltools.org/download-1.0.html">sgml-tools,
|
| 1000 |
version 1</debianpackage></title>
|
| 1001 |
<para>
|
| 1002 |
<footnote debianversionmin="2.2"><para>Did you notice the change in the
|
| 1003 |
capitalization?</para></footnote>
|
| 1004 |
This version is officially deprecated and should no
|
| 1005 |
longer, in theory, be used anymore. But, in practice, since
|
| 1006 |
the move of the Linux Documentation Project from LinuxDoc to
|
| 1007 |
the DocBook DTD never occured, you still need sgml-tools
|
| 1008 |
version 1.</para>
|
| 1009 |
</sect2>
|
| 1010 |
<sect2 id="modularss">
|
| 1011 |
<title><debianpackage name="docbook-stylesheets"
|
| 1012 |
refserver="http://www.nwalsh.com/docbook/dsssl/index.html">
|
| 1013 |
Norman Walsh's "DocBook Modular Stylesheets"</debianpackage></title>
|
| 1014 |
<para>These are a set of DSSSL stylesheets (with a recent XSL version). You
|
| 1015 |
can use them with any DSSSL tool, like &jade; to process DocBook documents.</para>
|
| 1016 |
</sect2>
|
| 1017 |
</sect1>
|
| 1018 |
|
| 1019 |
<sect1 id="references">
|
| 1020 |
<title>References</title>
|
| 1021 |
<itemizedlist>
|
| 1022 |
<listitem>
|
| 1023 |
<para>SGML in general</para>
|
| 1024 |
<itemizedlist>
|
| 1025 |
<listitem>
|
| 1026 |
<para><ulink
|
| 1027 |
url="http://www.oasis-open.org/cover/">Cover's
|
| 1028 |
page</ulink></para>
|
| 1029 |
</listitem>
|
| 1030 |
<listitem>
|
| 1031 |
<para><ulink
|
| 1032 |
url="http://www-tei.uic.edu/orgs/tei/sgml/teip3sg/index.html">
|
| 1033 |
A Gentle Introduction to SGML</ulink> by the TEI people. Not very
|
| 1034 |
practical, IMHO. <comment>TODO: read it again, Sam.</comment>
|
| 1035 |
</para>
|
| 1036 |
</listitem>
|
| 1037 |
<listitem>
|
| 1038 |
<para>The <ulink
|
| 1039 |
url="http://www.flightlab.com/~joe/sgml/faq-not.txt">non-FAQ</ulink><footnote><para>Why
|
| 1040 |
DocBook doesn't have a <sgmltag
|
| 1041 |
class="element">humour</sgmltag> element?</para>
|
| 1042 |
</footnote></para>
|
| 1043 |
</listitem>
|
| 1044 |
</itemizedlist>
|
| 1045 |
</listitem>
|
| 1046 |
<listitem>
|
| 1047 |
<para>XML in general</para>
|
| 1048 |
<itemizedlist>
|
| 1049 |
<listitem>
|
| 1050 |
<para><ulink
|
| 1051 |
url="http://www.w3.org/XML/">Official XML</ulink></para>
|
| 1052 |
</listitem>
|
| 1053 |
<listitem>
|
| 1054 |
<para><ulink
|
| 1055 |
url="http://www.oasis-open.org/cover/xml.html">Cover's XML
|
| 1056 |
page</ulink></para>
|
| 1057 |
</listitem>
|
| 1058 |
<listitem>
|
| 1059 |
<para><ulink
|
| 1060 |
url="http://www.ucc.ie/xml/">XML FAQ</ulink></para>
|
| 1061 |
</listitem>
|
| 1062 |
</itemizedlist>
|
| 1063 |
</listitem>
|
| 1064 |
<listitem>
|
| 1065 |
<para>DocBook</para>
|
| 1066 |
<itemizedlist>
|
| 1067 |
<listitem>
|
| 1068 |
<para><ulink url="http://www.oasis-open.org/docbook/">Official
|
| 1069 |
DocBook</ulink></para>
|
| 1070 |
</listitem>
|
| 1071 |
<listitem>
|
| 1072 |
<para><debiandoc file="index.html">docbook-doc</debiandoc></para>
|
| 1073 |
</listitem>
|
| 1074 |
<listitem>
|
| 1075 |
<para><ulink url="http://www.nwalsh.com/docbook/dsssl/">
|
| 1076 |
Modular DocBook Stylesheets</ulink></para>
|
| 1077 |
</listitem>
|
| 1078 |
<listitem>
|
| 1079 |
<para><ulink url="http://www.freebsd.org/tutorials/docproj-primer/">
|
| 1080 |
FreeBSD Documentation Project Primer</ulink> is a nice introduction to
|
| 1081 |
SGML and
|
| 1082 |
DocBook</para>
|
| 1083 |
</listitem>
|
| 1084 |
<listitem>
|
| 1085 |
<para><ulink
|
| 1086 |
url="http://www.nwalsh.com/docbook/simple/sdocbook/">
|
| 1087 |
Simplified DocBook</ulink>, a version of DocBook with
|
| 1088 |
less elements to learn</para>
|
| 1089 |
</listitem>
|
| 1090 |
<listitem id="docbook-custom">
|
| 1091 |
<para>Different customizations or extensions to
|
| 1092 |
DocBook</para>
|
| 1093 |
<itemizedlist>
|
| 1094 |
<listitem><para><ulink
|
| 1095 |
url="http://www.onshore.com/">onShore</ulink>'s custom
|
| 1096 |
stylesheets are in a unofficial Debian package,
|
| 1097 |
"onshore-sgml". To get it, add <filename>deb
|
| 1098 |
http://cafe.onshore.com/debian local/</filename> to your
|
| 1099 |
<filename>/etc/apt/sources.list</filename>. </para>
|
| 1100 |
</listitem>
|
| 1101 |
<listitem><para>Norman Walsh puts online <ulink url="http://www.nwalsh.com/website/">all the stuff needed</ulink>
|
| 1102 |
to manage <ulink url="http://www.nwalsh.com/">his Web site</ulink>.</para>
|
| 1103 |
</listitem>
|
| 1104 |
<listitem><para>FreeBSD has <ulink
|
| 1105 |
url="http://www.freebsd.org/tutorials/docproj-primer/tools.html#AEN228">DocBook
|
| 1106 |
customizations</ulink>, too.</para>
|
| 1107 |
</listitem>
|
| 1108 |
</itemizedlist>
|
| 1109 |
</listitem>
|
| 1110 |
</itemizedlist>
|
| 1111 |
</listitem>
|
| 1112 |
<listitem>
|
| 1113 |
<para>LinuxDoc</para>
|
| 1114 |
<itemizedlist>
|
| 1115 |
<listitem>
|
| 1116 |
<para><ulink
|
| 1117 |
url="http://www.sgmltools.org/guide/guide.html">Matt
|
| 1118 |
Welsh's SGML-Tools User's Guide</ulink></para>
|
| 1119 |
</listitem>
|
| 1120 |
</itemizedlist>
|
| 1121 |
</listitem>
|
| 1122 |
<listitem id="otheros">
|
| 1123 |
<para>Other operating systems: this section will list
|
| 1124 |
documents similar to this HOWTO (I mean
|
| 1125 |
<emphasis>practical</emphasis> documents) for operating systems
|
| 1126 |
other than Debian.</para>
|
| 1127 |
<itemizedlist>
|
| 1128 |
<listitem>
|
| 1129 |
<para><ulink
|
| 1130 |
url="http://ourworld.compuserve.com/homepages/hoenicka_markus/ntsgml.html">Microsoft
|
| 1131 |
Windows NT</ulink></para>
|
| 1132 |
</listitem>
|
| 1133 |
<listitem>
|
| 1134 |
<para>RedHat users of DocBook should probably <ulink
|
| 1135 |
url="http://sourceware.cygnus.com/docbook-tools/">see the
|
| 1136 |
Cygnus tools</ulink>.</para>
|
| 1137 |
</listitem>
|
| 1138 |
<listitem>
|
| 1139 |
<para>For FreeBSD, if you want to use DocBook, see their
|
| 1140 |
<ulink
|
| 1141 |
url="http://www.freebsd.org/tutorials/docproj-primer/tools.html">FreeBSD
|
| 1142 |
Documentation Project Primer for New
|
| 1143 |
Contributors</ulink>, specially its list of mandatory tools.</para>
|
| 1144 |
</listitem>
|
| 1145 |
<listitem>
|
| 1146 |
<para>
|
| 1147 |
SuSE's has <ulink url="http://www.suse.de/~ke/docbook-tools/">some tools</ulink> to process DocBook documents easily.
|
| 1148 |
</para>
|
| 1149 |
</listitem>
|
| 1150 |
<listitem>
|
| 1151 |
<para>
|
| 1152 |
It is not operating system-specific but O'Reilly has a
|
| 1153 |
<ulink
|
| 1154 |
url="http://www.oreilly.com/people/staff/crism/dsssl/orastyle/">nice
|
| 1155 |
documentation</ulink> about their publishing system.
|
| 1156 |
</para>
|
| 1157 |
</listitem>
|
| 1158 |
</itemizedlist>
|
| 1159 |
</listitem>
|
| 1160 |
</itemizedlist>
|
| 1161 |
<bibliography>
|
| 1162 |
<title>Interesting books</title>
|
| 1163 |
<biblioentry>
|
| 1164 |
<citetitle><ulink url="http://www.snee.com/bob/sgmlfree/">SGML CD</ulink></citetitle>
|
| 1165 |
<author>
|
| 1166 |
<surname>DuCHARME</surname>
|
| 1167 |
<firstname>Bob</firstname>
|
| 1168 |
</author>
|
| 1169 |
<editor>
|
| 1170 |
<surname>Prentice-Hall</surname>
|
| 1171 |
</editor>
|
| 1172 |
<isbn>0-13-475740-8</isbn>
|
| 1173 |
<abstract>
|
| 1174 |
<para>A very good and practical book about the tools
|
| 1175 |
needed to write and process SGML on Unix and Windows
|
| 1176 |
NT. Does not cover XML. A very good chapter about &psgml;
|
| 1177 |
and a nice page of <ulink url="http://www.snee.com/bob/sgmlfree/emcspsgm.html">PSGML tricks</ulink>.</para>
|
| 1178 |
</abstract>
|
| 1179 |
</biblioentry>
|
| 1180 |
<biblioentry>
|
| 1181 |
<citetitle>DocBook: <ulink url="http://www.docbook.org/">The Definitive Guide</ulink></citetitle>
|
| 1182 |
<author>
|
| 1183 |
<surname>Walsh</surname>
|
| 1184 |
<firstname>Norman</firstname>
|
| 1185 |
</author>
|
| 1186 |
<author>
|
| 1187 |
<surname>Muellner</surname>
|
| 1188 |
<firstname>Leonard</firstname>
|
| 1189 |
</author>
|
| 1190 |
<editor>
|
| 1191 |
<surname>O'Reilly</surname>
|
| 1192 |
</editor>
|
| 1193 |
<isbn>1-56592-580-7</isbn>
|
| 1194 |
<abstract>
|
| 1195 |
<para>I didn't read it yet. The entire book is
|
| 1196 |
also online.</para>
|
| 1197 |
</abstract>
|
| 1198 |
</biblioentry>
|
| 1199 |
</bibliography>
|
| 1200 |
</sect1>
|
| 1201 |
</article>
|
| 1202 |
|
| 1203 |
|
| 1204 |
|
| 1205 |
|