Print

Print


On Thu, 6 Feb 1997, Joseba Abaitua wrote:
 
> Is there any way to indicate the linear order in which tags may occur in
> a document?
>
> This is our problem:
>
> We want to generate text from a DTD. This DTD has a number of <DIV
> type=ATT> sections, but we don't find any way to express their relative
> order in the document by means of their attributes.  Is there any
> possible way of stating this ordering in the DTD, such that:
>
> <DIV type=heading>
> <DIV type=body>
> <DIV type=end>
>
> <!ELEMENT - - DIV+ >
> <!ATTlLIST  div (heading | body | end)>
 
        It is a simple matter to indicate in a content model the order in
which elements may occur, by listing them in sequential order and
separating them with the sequence connector, ",".  It is not possible to
make that order a condition of the presence or absence of attributes or
attribute values.  If allowed, this would mean that after parsing a DTD,
the parser would have incomplete knowledge of the structural rules in
effect for a document instance!
 
        If the concepts 'heading,' 'body,' and 'end' are significant because
they imply a certain order in the logical structure of your document,
then that implies in turn that they are in fact structural units, which
is to say, elements.  Perhaps you should just call a spade a spade and write
 
        <!ELEMENT DIV - -       ( heading, body, div ) >
        <!ELEMENT ( heading | body | end ) - - ( [....] ) >
 
        If you are using the TEI DTD, the DIV element already has two
children elements, HEAD and TRAILER, which may or may not conform to the
role that you envisage for HEADING and END above.  If the role isn't
quite right, you can still use them, but are strongly encouraged to
document your usage in the header. See 7.2 in the _Guidelines_.  As for
the third element, BODY, it would just be all the stuff after the HEAD
and before the TRAILER.
 
 
- Gregory Murphy