This section is no longer oriented toward tasks, but toward software that you can use to write and process SGML.
The simplest way to get all these tools is to install task-sgml (Debian package).
An excellent SGML mode for Emacs. Among its many features, it can:
Show you what tags are valid at a given point,
Insert tags (begin and end, as well as mandatory tags in between) from a menu which shows only valid tags (this is tremendously useful when you start to use a new and complicated DTD),
Manipulate SGML elements, move according to elements, etc.
Its documentation is in
Having some options set up in your ~/.emacs will ease your use of psgml. Here are some examples:
(autoload 'xml-mode "psgml" "Major mode to edit XML files." t ) (setq auto-mode-alist (append '( ;; DocBook-XML ("\\.db" . xml-mode) ) auto-mode-alist)) (add-hook 'sgml-mode-hook 'turn-on-auto-fill) (setq sgml-custom-dtd '( ( "HTML 4.0 Strict" "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"dtd/html-4.0s.dtd\">" ) ( "HTML 4.0 Blaireau" "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML Transitional 4.0//EN\" \"dtd/html-4.0-loose.dtd\">" ) ( "DocBook 3.1 XML Article" "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?> <!DOCTYPE article PUBLIC \"-//Norman Walsh//DTD DocBk XML V3.1//EN\" \"dtd/docbook-xml/docbookx.dtd\">" ) )) (setq sgml-insert-missing-element-comment nil)
Among the most useful psgml commands:
C-c C-t : sgml-list-valid-tags reminds you (or teaches you) the DTD. Very convenient when you start playing with a monster like DocBook.
sgml-insert-element. Again, a great way to learn a DTD
An SGML tool, for instance for validating SGML documents. A typical use is to check the validity of a document:
nsgmls -s file.sgml
This will check whether or not the contents of the file file.sgml conform to the DTD indicated in the header of the file.
If you write XML documents, two options of nsgmls are necessary:
nsgmls -s -wxml /usr/lib/sgml/declaration/xml.dcl file.sgml
There is a
A pure XML tool; can, for instance, be used to validate XML documents.
jade is a DSSSL processor. It takes an SGML file and a stylesheet, written in the DSSSL language, and produces output in the TeX (for which PostScript can be made), RTF or HTML formats. It has no backend for groff and therefore has trouble producing ASCII. The TeX backend produces jadetex files.
The documentation is not really clear but it at leasts
tell you the various options. See
Typical uses:
jade -t backend-to-use -d stylesheet-name input-file
A set of TeX macros to process the output of jade. Poorly documented and difficult to customize. Like with every TeX macros, several runs may be necessary, in particular to resolve references.
The SGMLtools exist in two versions, 1 and 2. SGMLtools is the version 2.
Unlike sgml-tools, version 1, which processes LinuxDoc documents, SGMLtools, version 2, treats DocBook documents. You can do everything it does with direct calls to jade but it may be simpler to use SGMLtools.
[1] This version is officially deprecated and should no longer, in theory, be used anymore. But, in practice, since the move of the Linux Documentation Project from LinuxDoc to the DocBook DTD never occured, you still need sgml-tools version 1.
These are a set of DSSSL stylesheets (with a recent XSL version). You can use them with any DSSSL tool, like jade to process DocBook documents.
[1] | Did you notice the change in the capitalization? |