Re: sgml transform, one-to-one plus toc.

Subject: Re: sgml transform, one-to-one plus toc.
From: Chris Maden <crism@xxxxxxx>
Date: Fri, 10 Oct 1997 10:34:56 -0400
[David Pawson]
> What is the minimal spec to do an sgml-sgml transform using the same
> tags? Then I can add the toc in where needed, reconstituting the
> full document, including contents.  Can I use a default treatment to
> get the remainder of the elements and content copied through?

Yes.  The simplest answer is

(default (make element
	       gi: (gi (current-node))
	       attributes: (some-function)))

Where (some-function) is something like (attributes (current-node)),
but I'm working from home today and 10179 is at work.

However, this will produce things like <img></img> which isn't
desirable.  I've also found that (make element) with no content
expression will sometimes produce only a start-tag.  For a fixed DTD,
you can try this:

(default (if (member (gi (current-node))
		     empty-element-list)
	     (make empty-element
		   gi: (gi (current-node))
		   attributes: (some-function))
	     (make element
		   gi: (gi (current-node))
		   attributes: (some-function))))

where empty-element-list is something like '("BR" "HR" "IMG" "LINK"
"META").

HTH,
Chris
-- 
<!NOTATION SGML.Geek PUBLIC "-//Anonymous//NOTATION SGML Geek//EN">
<!ENTITY crism PUBLIC "-//O'Reilly//NONSGML Christopher R. Maden//EN"
"<URL>http://www.oreilly.com/people/staff/crism/ <TEL>+1.617.499.7487
<USMAIL>90 Sherman Street, Cambridge, MA 02140 USA" NDATA SGML.Geek>

 DSSSList info and archive:  http://www.mulberrytech.com/dsssl/dssslist


Current Thread