SGML declarations for subdocuments

Subject: SGML declarations for subdocuments
From: Norman Gray <norman@xxxxxxxxxxxxxxx>
Date: Wed, 6 Oct 1999 12:50:43 +0100 (BST)
Greetings,

Can someone tell me what I'm not understanding here.

I'm using Jade to process documents which conform to a DTD which uses
an SGML declaration which has NAMECASE GENERAL NO, and which has
subdocuments.  The NAMECASE declaration seems not to apply to the
subdocuments, though I thought it would, since subdocuments may not
have their own SGML declaration, and must instead use the same
declaration as their parent.

The set of files copied below displays the situation.  The FOT at the
end shows that the NAME attributes are being case-folded up in the
subdocument, even though I would have thought that the SGML
declaration in force when the main document was parsed would also have
been in effect then, so that there would be no case-folding of NAME
attributes.

I can't find anything in the standard which seems relevant to this,
excepting productions 2 and 3, which, by stating that a subdocument
may not have its own declaration, also imply (I suppose) that the
subdocument is parsed using the SGML declaration of its parent
document.  The tutorial section in C.3.2 states `An SGML subdocument
entity must conform to the SGML declaration of the SGML document
entity, [...]', which seems pretty clear even if it's not part of the
standard text.  The documentation for sgml-parse in 10179 does not
mention the SGML declaration, and Jade's documentation doesn't mention
any limitation that seems (to me) relevant (though I've been caught
before here!).



% cat simple.dtd
<!ELEMENT simple O O (a|xref)+>
<!ELEMENT a      - O EMPTY>
<!ELEMENT xref   - O EMPTY>
<!ATTLIST a
        name NAME #REQUIRED
        >
<!ATTLIST xref
        doc ENTITY #REQUIRED
        >

% cat simple1.sgml
<!DOCTYPE simple SYSTEM 'simple.dtd' [
<!ENTITY s2 SYSTEM 'simple2.sgml' SUBDOC>
]>
<a name=one>
<xref doc=s2>
<a name=two>
% cat simple2.sgml
<!doctype simple system 'simple.dtd'>
<a name=sub>
% cat simple.dsl
<!DOCTYPE style-sheet PUBLIC "-//James Clark//DTD DSSSL Style Sheet//EN">

(define (document-element #!optional (node (current-node)))
  (node-property 'document-element node default: (empty-node-list)))

(define (normalize str)
  (if (string? str)
      (general-name-normalize str (current-node))
      str))

(element a
  (let ((name (attribute-string (normalize "name") (current-node))))
    (literal (string-append "name=" name))))

(element xref
  (let* ((xrefent (attribute-string (normalize "doc") (current-node))))
    (process-node-list
     (document-element (sgml-parse (entity-generated-system-id xrefent))))))
% jade -d simple.dsl $SS/dtd/starlink.decl simple1.sgml
% cat simple1.fot
<?xml version="1.0"?>
<fot>
<a name="0"/>
<a name="1"/>
<text>name=one</text>
<a name="2"/>
<a name="2.0"/>
<a name="2.1"/>
<text>name=SUB</text>
<a name="3"/>
<text>name=two</text>
</fot>


Oooh, me 'ead 'urts....

All the best,

Norman


---------------------------------------------------------------------------
Norman Gray                        http://www.astro.gla.ac.uk/users/norman/
Physics and Astronomy, University of Glasgow, UK     norman@xxxxxxxxxxxxxxx


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


Current Thread