From: SGML@ifi.uio.no (Erik Naggum)
Newsgroups: comp.text.sgml
Subject: Re: Change bars in SGML
Date: 26 Aug 92 23:39:11 GMT
Organization: Department of Informatics, University of Oslo, Norway

William Skyvington <skyvington@republique.ilog.fr> writes:
|
|   My question is no doubt naive, because I'm a newcomer to SGML.

Au contraire, it's a hard nut.

|   I'm curious to know how change bars should be handled in [...]
|   SGML [...].

Ask yourself "what meaningful information is it that we try to convey
with change bars", and you would most probably come up with something
like "we get to know what's changed since the previous printing",
subsequently refined to "it's a means to express incremental differences
between versions of the same document".  In other words, we need to have
means to express versions in SGML, and if we can look at more than one
revision at a time, voila! we know all we need to know to make the
change bars, and they can be produced automatically, rather than by the
(unreliable?) author.

Now, I have used marked sections for version control with some success,
but have found a few problems which I need to address before I want to
make the solution public.  The following will have to suffice:

For a revision N, make two parameter entities I<N> and D<N>, for
"inserted at revision N" and "deleted in revision N", respectively.
These will default to "INCLUDE" and "IGNORE", respectively, so that you
can have a body of text like this:

        Now is the time for all good <![%I0002[citizens]]>
        <![%D0002[men<![%I0001[ and women]]>]]> to come to the aid of
        their country.

which reflects these revisions:

 0:     Now is the time for all good men to come to the aid of ...
 1:     Now is the time for all good men and women to come to ...
 2:     Now is the time for all good citizens to come to the aid ...

The entity declarations would like this:

<!ENTITY % I0001 "INCLUDE">     <!ENTITY % D0001 "IGNORE">
<!ENTITY % I0002 "INCLUDE">     <!ENTITY % D0002 "IGNORE">

To retrieve a particular revision, swap the entity text of all version
control parameter entities after this revision.  E.g. to retrieve
revision 1 from a document which had revision 2 in it:

<!ENTITY % I0001 "INCLUDE">     <!ENTITY % D0001 "IGNORE">
<!ENTITY % D0002 "INCLUDE">     <!ENTITY % I0002 "IGNORE">

What I desparately wish that SGML would include with marked section
status keywords, is a "NOT" operator, and perhaps the whole set of
boolean operators.  This would cut down on the number of entities.

(The way I actually make the entity set is to use the dreaded SYSTEM
identifier with an entity declaration like this:

	<!ENTITY % revision SYSTEM "| revision 5"> %revision;

(NAMELEN = 32, not the default 8), where "| revision 5" means "run the
program "revision" with argument "5", and use that as the entity text.
revision is a small program which just produces the above parameter
entity declarations according to the argument.)

I have made no provisions for departures from a single, accumulating
list of revisions ("for further study" as they say in CCITT), or allowed
for transposing text in a simple and elegant way.  (E.g. "xy" -> "yx" is
a destructive revision in terms of applying or ignoring individual
edits, in that either "x" or "y" must occur twice in the document, and
keeping track of revisions to the other copy if changes are made after
the transposition which should be individually selectable.)

Note that a link process declaration can override the entity
declarations in the document type declaration, and that thus one can
make a link process which retrieves the previous revision, and run the
two revisions through an application which marks differences on some
useful level (such as sentences).  I haven't actually tried this, but
it should be a simple matter of programming.

Alternatively, an SGML parser could be instructed to inform the
application of marked section boundaries.  This would undoubtedly be
much more elegant, but it's currently not included in the ESIS.

Hope this shed some light on the problem.  Comments are welcome.

Best regards,
</Erik>
--
Erik Naggum             |  ISO  8879 SGML     |      +47 295 0313
                        |  ISO 10744 HyTime   |
<erik@naggum.no>        |  ISO 10646 UCS      |      Memento, terrigena.
<enag@ifi.uio.no>       |  ISO  9899 C        |      Memento, vita brevis.