🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.text.sgml
Article #741

Re: Psgml and ECAT

#741
From: ronross
Date: Thu, 29 Apr 1999 00:00
146 lines
7500 bytes
On 28 Apr 1999, vhaag@rim.net wrote:
 [snip]
> Is there a mode for editing SGML source?
> ++++++++++++++++++++++++++++++++++++++++
>
> Yes. Lennart Staflin has a mode called "PSGML" for editing SGML
> coded documents. You can find the package's web page at:
>
>         http://www.lysator.liu.se/projects/about_psgml.html


I've mentioned it before on the nt-emacs list, but it bears repeating:
anyone getting into SGML with NT Emacs for the first time will be
immensely rewarded by visiting Markus Hoenicka's pages devoted to the
subject:

http://ourworld.compuserve.com/homepages/hoenicka_markus/ntsgml.html

Markus ties together a lot of the packages required to setup a complete
SGML publishing environment, which Psgml on its own is not meant to be. At
the very least, you want a validator. Presumably, you would also like to
output your sgml instances by coupling them with some formating
instructions. Both a validator and DSSSL stylesheet processor are included
in Jade. Then you want a choice of DTDs; and there are modes for editing
DTDs, and DSSSL stylesheets,...This site, as long as it exists, should be
included the SGML topic in the FAQ. The FAQ should probably also simply
list the URIs of the essential packages themselves as well: Jade, tdtd.el,
psgml-dsssl.el, psgml-jade.el, as well as psgml.

However, Hoenicka doesn't deal with a lot of the finer points, including
producing and using the ECAT files. Thus, Viktor's contribution is highly
apropos. I would like to point out a few things, though, some of which
simplify the procedure, while others ... complicate them somewhat.



> PSGML (by default) seems to want to put compiled DTDs in the
> same directory as the current buffer's instance. And for the
> default name of the compiled DTD it uses the basename of the
> current buffer's instance. Suppose you want to put a compiled DTD
> along with the uncompiled DTD, so that all your instances can use
> it (especially useful for HTML DTDs, for example)?
>
> Here's a technique that works -- I assume that you've already set
> up PSGML with your DTDs in some central location (as defined by
> the "sgml-catalog-files" and "sgml-public-map" variables), and
> that you know what an SGML catalog file is.
>
> * Go to the directory that contains your DTDs

When PSGML compiles the DTD it prompts for the file name of the compiled
file in the minibuffer, which it fills with its default value. But you can
simply edit this to change the path and filename to indicate an
appropriately named .ced file in the directory of your choice. Hit RET and
the compilation proceeds. It worked for me (nt emacs 20.3.1 and psgml
1.1.6).
>
> * In that directory create a temporary instance that contains
>   only the <!DOCTYPE> for the DTD you want to compile.
>
> * Parse the DTD (type C-c C-p, invoke sgml-parse-prolog, go to
>   the end of the buffer and press TAB, or choose DTD->Parse DTD)

Yes, definitely parse the DTD first. But I would further suggest that you
also validate the instance before compiling. Nsgmls (the parser included
in James Clark's Jade) will uncover inconsistencies in DTDs and entities
that Psgml will blithely ignore.

Also, the latest HTML DTDs (version 4) come in three flavors, and if
you're going to produce varied types of pages, you'll want all three as
well as the earlier 3.2. These are strict.dtd, loose.dtd (otherwise called
HTML 4 Transitional), and frameset.dtd. This pertains to compilation
because the frameset.dtd is just a driver for the elements in the
loose.dtd (note that I've seen these DTDs under slightly different, though
pretty recognizable names). You'll want to compile the frameset DTD
_before_ compiling the loose DTD. Doing the reverse caused problems for
me.


[While we're on this subject, I don't know about others' experience, but I
have had to edit the entity identifiers in all the latest HTML DTDs
because they pointed to the W3 Consortium's web site. PSGML chokes on
this, while Nsgmls, when invoked to validated the instance, takes it in
stride, dials up my ISP, reads the remote entity files, and validates my
document. This, in fact, is a stumbling block long before you get to
compiling the DTD. Assuming you've also gotten all the required entities
from somewhere (W3C is a good choice), then you have to edit the entity
reference, as I have, for example, from (line 169 in the loose.dtd):

<!ENTITY % HTMLlat1 PUBLIC
   "-//W3C//ENTITIES Latin1//EN//HTML"
   "http://www.w3.org/TR/REC-html40-971218/HTMLlat1.ent">
%HTMLlat1;

to

<!ENTITY % HTMLlat1 PUBLIC
   "-//W3C//ENTITIES Latin1//EN//HTML"
   "HTMLlat1.ent">
%HTMLlat1;

having put the entity files (ex: HTMLlat1.ent) in the same directory as
the DTDs. It seems a little strange to have to do this (yes, I have
correctly referenced them in my catalog file); did I overlook something
stupid?... Anyway, it's something to look out for when setting things up.]


> * Save the DTD (invoke sgml-save-dtd, or choose DTD->Save Parsed
[snip]
> * In your .emacs, where you have your SGML config, you'll want
>   something like this form:
>
>         (add-hook 'sgml-mode-hook
>                 (function
>                  (lambda ()
>                   "Config stuff for sgml mode."
>                   (setq sgml-catalog-files
>                     (list
>                      (expand-file-name "/mySGMLpath/catalog")))
>                   (setq sgml-ecat-files
>                     (list
>                      (expand-file-name "/mySGMLpath/ecatalog")))

Sgml-catalog-files can be set as a system environment variable, and
therefore not dealt with within Emacs at all; the elisp variable takes its
value from the environment. Doing it this way is required, I think, if
you're going to get the other tools working together as well. The
'sgml-ecat-files' variable can also be set very simply in Customize. But
I'm wondering, in terms of straight elisp, why can't the variable be set
with a simple (setq sgml-ecat-files "mySGMLpath/ecatalog") on its own,
i.e., not in a hook to sgml-mode?



Overall, Viktor, your post represents an excellent initiative. Pesky
little configuration issues seem to abound and sometimes spoil the fun.
But I'm wondering about the form discussion can take on a cross-posted
message? I'm replying now on two out of three of the lists (since the
subject seems relevant to both), but I can't see keeping it up very
long... hm.

Ron
.

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    
Technical Details
Message-ID: <7g8hm9$dse$1@nnrp1.dejanews.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <7g7lnk$l15$1@nnrp1.dejanews.com> <wk90bcbiah.fsf@rim.net>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fa82c,8efbbedde372ba6e
X-Google-Attributes: gidfa82c,public
X-Google-Thread: 102b9a,e414c2003a82bdac
X-Google-Attributes: gid102b9a,public
X-Google-Thread: 103b8b,e414c2003a82bdac
X-Google-Attributes: gid103b8b,public
From: ronross@colba.net
Subject: Re: Psgml and ECAT
Date: 1999/04/29
Message-ID: <7g8hm9$dse$1@nnrp1.dejanews.com>
X-Deja-AN: 472114313
References: <7g7lnk$l15$1@nnrp1.dejanews.com> <wk90bcbiah.fsf@rim.net>
X-Http-Proxy: 1.1 x13.dejanews.com:80 (Squid/1.1.22) for client 207.107.207.157
Organization: Deja News - The Leader in Internet Discussion
X-Article-Creation-Date: Thu Apr 29 02:55:06 1999 GMT
Newsgroups: comp.text.sgml,comp.emacs,gnu.emacs.help
X-Http-User-Agent: Mozilla/4.0 (compatible; MSIE 4.01; Windows 95)