Steven R. Newcomb
28 June 1994
© SGML SIGhyper


<!-- Revised instance and DTD of DOCTYPE review ("Location Address &
     Hyperlinking" in SGML SIGhyper Newsletter 1:1).  V. Newcomb.
     Copyright (c) 1993 TechnoTeacher, Inc. -->

<!-- This example uses some of HyTime's location address facilities
     and hyperlinking facilities.  The document type defined is that
     of a simple review document. -->

<!-- HyTime Support Declarations. These declarations are processing
     instructions placed ahead of the DTD in the document's prolog.
     They inventory the HyTime facilities that the application must
     support for this document type. -->

<?HyTime VERSION "ISO/IEC 10744:1992" HYQCNT=32>
<?HyTime MODULE base context exidrefs>
<?HyTime MODULE measure>
<?HyTime MODULE locs multloc anydtd coordloc pathloc>
<?HyTime MODULE links manyanch>

<!-- SGML/HyTime Document Type Definition (DTD): -->

<!DOCTYPE review [

<!ENTITY  % loc "nameloc|dataloc|treeloc">

<!ELEMENT review - O (comment*) +(%loc;|revlink)>
<!ATTLIST review HyTime    NAME     HyDoc
                 id        ID       #REQUIRED
                 boslevel  NUMBER   #IMPLIED
                 reviewer  CDATA    #REQUIRED
                 date      CDATA    #REQUIRED >

<!-- This is the #000##000#cument element for the review document type. The
     boslevel attribute can provide a limit to the depth of the entity
     tree that constitutes the set of documents processable with a
     given "review" document; if not specified, the application
     decides what the set boundaries are. -->

<!ELEMENT nameloc  - O      (nmlist*) >
<!ATTLIST nameloc  HyTime   NAME     nameloc
                   id       ID       #REQUIRED
                   ordering (ordered|noorder) noorder
                   set      (set|notset) notset
                   aggloc   (aggloc|agglink|nagg) nagg >

<!ELEMENT nmlist   - O      (#PCDATA) >
<!ATTLIST nmlist HyTime   NAME     nmlist
                   nametype (entity|element|unified) #REQUIRED
                   obnames  (obnames|nobnames) #REQUIRED
                   docorsub ENTITY   #IMPLIED
                   dtdorlpd NAMES    #IMPLIED >

<!-- A nameloc element type assigns its own local unique identifier
     (ID) to one or more entities or elements, internal or external to
     the review document.  Subsequently, reference may be made to
     these entities or elements by referring to the ID of the nameloc.
     The nmlist element(s) contained in a nameloc establish the
     parsing context for the elements or entities that are listed.

     As will be seen in the example instance of a review document, the
     nameloc element may play a part in a location "ladder", in which
     location address elements are chained to accomplish specific
     locating tasks. -->

<!ELEMENT comment - O (#PCDATA)>
<!ATTLIST comment id      ID    #IMPLIED>

<!-- This document type's "comment" element type carries the
     reviewer's message.  It may also serve as an anchor of a
     traversible hyperlink to relevant part(s) of the document(s)
     being reviewed. -->

<!ELEMENT revlink  - O      EMPTY >
<!ATTLIST revlink  HyTime   NAME     ilink
                   id       ID       #IMPLIED
                   anchrole CDATA    #FIXED "subject #AGG comment #AGG"
                   linkends IDREFS   #REQUIRED
                   extra    NAMES    A
                   intra    NAMES    A
                   endterms IDREFS   #IMPLIED
                   aggtrav  NAMES    agg >

<!-- The revlink is built on HyTime's ilink architectural form; it is
     constrained in this type to two linkends, the first pointing to
     the subject of a comment, the second to the comment itself.
     Either or both of these linkends can be aggregate; that is, each
     linkend could point to a multiple location. -->

<!ELEMENT marklist O O   (marklist|#PCDATA)* >
<!ATTLIST marklist HyTime  NAME     #FIXED marklist >

<!ELEMENT dimlist  O O   (dimlist|marklist|#PCDATA)* >
<!ATTLIST dimlist  HyTime  NAME     dimlist >

<!-- The marklist and dimlist element types, built on forms in
     HyTime's measurement module, are used in the dataloc and treeloc
     element types declared below to locate information objects by
     position within a range of objects (i.e., along a conceptual
     coordinate axis). -->

<!ELEMENT dataloc  - O      (dimlist*) >
<!ATTLIST dataloc  HyTime   NAME     dataloc
                   id       ID       #REQUIRED
                   quantum  (str|norm|word|name|sint|date|time|utc) str
                   catsrc   (catsrc|nocatsrc) nocatsrc
                   catres   (catres|nocatres) nocatres
                   overrun  (error|wrap|trunc|ignore) error
                   locsrc   IDREFS   #IMPLIED
                   ordering (ordered|noorder) noorder
                   set      (set|notset) notset
                   aggloc   (aggloc|agglink|nagg) nagg >

<!-- Both the dataloc and treeloc elements locate unnamed objects
     (i.e.  objects or elements with no unique identifier, locally or
     externally) by using the dimlist and marklist coordinate
     addressing element types (declared above). -->

<!ELEMENT treeloc  - O      (marklist*) >
<!ATTLIST treeloc  HyTime   NAME     treeloc
                   id       ID       #REQUIRED
                   overrun  (error|wrap|trunc|ignore) error
                   treecom  (treecom|ntreecom) ntreecom
                   locsrc   IDREFS   #IMPLIED
                   ordering (ordered|noorder) noorder
                   set      (set|notset) notset
                   aggloc   (aggloc|agglink|nagg) nagg >

<!ENTITY fables SYSTEM "fables.doc" CDATA SGML>
<!NOTATION SGML PUBLIC
"ISO 8879:1986//NOTATION Standard Generalized Markup Language//EN">

<!-- This entity declaration includes the system address of an SGML
     document entity that is the object of our review instance.  This
     external entity is not an SGML subdocument entity; it could, for
     instance, have a different SGML declaration from that of the base
     document. -->

]>

<review id=rev1 boslevel=2 reviewer="g.wiz" date="05/13/93">

<!-- Specifying a boslevel of 2 indicates that entities declared in
     this document, but not entities declared in those entities, are
     to be included with this document when it is interchanged. -->

<comment id=c1>
Needlessly archaic wording; replace with "wanting".
</comment>

<nameloc id=subj1>
<nmlist nametype=element obnames=obnames docorsub=fables>grapes
<!-- The nameloc element "subj1" points to the named element "grapes", a
portion of the external entity "fables" -->

<treeloc id=tloc1 locsrc=subj1><marklist>1 2 4 3
<!-- gets unnamed subelement (child 3 of child 4 of child 2) of
"grapes"-->

<!-- This treeloc element locates an unnamed subelement by its
     position relative to a "root" element referred to by the locsrc
     attribute ("grapes", the object pointed to by the subject
     "subj1").  The treeloc's second marker (its first marker refers
     to the root element) designates the second element ("body") of
     the rank below root as the root for the next marker; the third
     marker in turn designates the fourth element ("para") of the rank
     below this new root as the next new root; the fourth marker
     designates the target node ("quote") as the third element of the
     first descending rank of the root set by the third marker. -->

<dataloc id=dloc1 locsrc=tloc1 quantum=norm><dimlist>-2 2
<!-- The dataloc element "dloc1" locates last two words (or tokens)
in the unnamed subelement of "grapes" identified by the treeloc
"tloc1". -->

<revlink linkends="dloc1 c1">

<!-- Traversal of the revlink hyperlink from the comment initiates the
     resolution of a "location ladder" that locates the offending
     phrase (two words) in the target document; the ladder includes
     the nameloc element "subj1", the treeloc element "tloc1", and the
     dataloc element"dloc1" listed as the first IDREF of the value of
     the revlink's linkends attribute.  The revlink could also be
     traversed from the other link end (that is, from the identified
     portion of the external document) back to the review comment
     "c1". -->

</review>


<!-- Diagram of location ladder:

     Review Document                       Reviewed Document
._______________________.         ._________________________________.
|                       |         |                                 |
|          .............|.........|.> (fabledoc)                    |
|        ,'             |         |                                 |
|    (nameloc)..........|.........|...=> (fable id=grapes)          |
|        .              |         | .'     (title)                  |
|       /.\             |         |'|                               |
|        .       .......|........'|  `.,=> (body)                   |
|        .     ,'       |         |  .'                             |
|    (treeloc)'         |         |  |       (para)                 |
|        .              |         |  |       (para)                 |
|       /.\             |         |   \      (para)                 |
|        .              |         |    `.,=> (para)                 |
|        .              |         |    .'                           |
|    (dataloc)..        |         |    |       (quote)              |
|               \       |         |     `.     #PCDATA              |
|                \      |         |       `==> (quote)              |
|                 \     |         |            ...worth gaping for. | 
|                  \    |         |                     __________  |
|                   \   |         |                          .      |
|                    \  |         |                         /|\     |
|                     \.|.........|..........................'      |
|_______________________|         |_________________________________|

-->


[ Index | Previous Paragraph | Next Paragraph ]