<?xml version="1.0"?>
<?xml-stylesheet href="links.css" type="text/css"?>
<?mde-javascript href="ctree.js"?>
<?mde-doctitle cdata="HyTime Links Demonstration"?>
<?mde-navigator href="toc.xsl" type="text/xsl" title="Table of Contents" name="links_toc"?>
<!DOCTYPE doc [

<!ELEMENT doc (title?,para*,chapter*)>
<!ATTLIST doc
          id ID #IMPLIED
>

<!ELEMENT title (#PCDATA)>

<!ELEMENT chapter (title,para*,sect1*)>
<!ATTLIST chapter
          id ID #IMPLIED
>

<!ATTLIST sect1
          id ID #IMPLIED
>

<!ATTLIST sect2
          id ID #IMPLIED
>

<!ATTLIST sect3
          id ID #IMPLIED
>

<!ELEMENT graphic EMPTY >
<!ATTLIST graphic
          entity ENTITY #REQUIRED
>

<!ATTLIST para
          id ID #IMPLIED
          idref IDREFS #IMPLIED
	  HyTime CDATA #FIXED "clink"
	  HyNames CDATA #FIXED "linkend idref"
>

<!-- Different links -->

<!ENTITY % locations "nameloc | treeloc | treeloc-hynames">

<!ATTLIST xref
          idref IDREF #REQUIRED
>

<!ATTLIST xref2
          idref CDATA #IMPLIED
>

<!ATTLIST xrefs
          idrefs IDREFS #REQUIRED
>

<!ATTLIST clink
          linkend IDREFS #REQUIRED
          HyTime CDATA #FIXED "clink"
>

<!ATTLIST extref
          linkend ENTITY #REQUIRED
          HyTime CDATA #FIXED "clink"
>

<!ATTLIST extrefs
          linkend ENTITIES #REQUIRED
          HyTime CDATA #FIXED "clink"
>

<!ATTLIST mixtref
          idrefs IDREFS #IMPLIED
          linkend IDREFS #IMPLIED
          HyTime CDATA #FIXED "clink"
>

<!ATTLIST clink-hynames
          idrefs IDREFS #IMPLIED
          target IDREFS #IMPLIED
          HyNames CDATA #FIXED "linkend target"
          HyTime CDATA #FIXED "clink"
>

<!-- Different locators -->

<!ELEMENT nameloc (nmlist | nmlist-hynames)* >
<!ATTLIST nameloc
          id ID #REQUIRED
          HyTime CDATA #FIXED "nameloc"
>

<!ELEMENT nmlist (#PCDATA)>
<!ATTLIST nmlist
          docorsub ENTITY #IMPLIED
          nametype (element|entity) "element"
          HyTime CDATA #FIXED "nmlist"
>

<!ELEMENT nmlist-hynames (#PCDATA)>
<!ATTLIST nmlist-hynames
          doc ENTITY #IMPLIED
          type (element|entity) "element"
          HyNames CDATA #FIXED "docorsub doc nametype type"
          HyTime CDATA #FIXED "nmlist"
>

<!ELEMENT treeloc (marklist*) >
<!ATTLIST treeloc
          id ID #REQUIRED
          locsrc IDREF #IMPLIED
          HyTime CDATA #FIXED "treeloc"
>

<!ELEMENT marklist (#PCDATA)>
<!ATTLIST marklist
          HyTime CDATA #FIXED "marklist"
>

<!ELEMENT treeloc-hynames (marklist*) >
<!ATTLIST treeloc-hynames
          id ID #REQUIRED
          target IDREF #IMPLIED
          HyNames CDATA #FIXED "locsrc target"
          HyTime CDATA #FIXED "treeloc"
>

<!NOTATION URL PUBLIC "-//IETF//NOTATION Uniform Resource Locator//EN" >

<!ELEMENT a (#PCDATA)>
<!ATTLIST a
        href      CDATA   #IMPLIED
        HyTime    CDATA    #FIXED "clink"
        HyNames   CDATA   #FIXED "linkend href"
        loctype   CDATA   #FIXED "href queryloc URL"
>

<!NOTATION NONE PUBLIC "-//Heikki Toivonen//NOTATION That Does Not
Exist//EN" >

<!ELEMENT b (#PCDATA)>
<!ATTLIST b
        href      CDATA   #IMPLIED
        HyTime    CDATA   #FIXED "clink"
        HyNames   CDATA   #FIXED "linkend href"
        loctype   CDATA   #FIXED "href queryloc NONE"
>

<!ELEMENT empty-link (#PCDATA)>
<!ATTLIST empty-link
          xref IDREFS #REQUIRED
>

<!NOTATION SGML PUBLIC "+//ISO 8879:1986//NOTATION Standard Generalized Markup Language//EN">

<!ENTITY target SYSTEM "target.sgm" NDATA SGML>
<!ENTITY middle SYSTEM "middle.sgm" NDATA SGML>
<!ENTITY target2 SYSTEM "target2.sgm" NDATA SGML>
<!ENTITY target-id1 SYSTEM "target.sgm#id1" NDATA SGML>
<!ENTITY target-doczilla-home SYSTEM "http://www.doczilla.com" NDATA URL>

<!ENTITY % gt ">">
<!ENTITY % lt "<">

<!NOTATION gif PUBLIC "+//ISBN 0-7923-9432-1::Graphic Notation//NOTATION Compuserve Graphic Interchange Format//EN">

<!ENTITY q SYSTEM "q.gif" NDATA gif>
]>
<doc id="doc1">
<title>DocZilla</title>
<chapter>
<title>Examples</title>
<sect1>
<title>Linking</title>
<para>DocZilla currently supports the following hypertext links:</para>

<itemizedlist>
<member>ID/IDREF(S), </member>
<member>HyTime clinks with nameloc, treeloc and queryloc (URL
notation),</member>
<member>XLinks and IDLoc XPointer and</member>
<member>HTML Anchors.  </member>
</itemizedlist>

<para>Examples
are given in this section.</para>

<para>You will note that following a link highlights the target. You
can turn this off by setting an environment variable
"MDE_DO_NOT_SELECT_LINK_TARGET" to non-empty value, e.g. "1". In
Windows NT/2000/XP you can do thisb in the control panel. In Windows
95/98/ME you must modify the autoexec.bat file. If you are using Linux
consult the manual page of your shell on how to set environment
variables.</para>

<sect2><title>Link Destinations</title>

<para>Link destinations in both XML or SGML documents can be identified
by associating an ID type of attribute value with an element - any element
(provided the Document Type Definition has allowed it for the element).
The following example of a chapter identified as a potential destination
with an ID value of "ChapterIX":</para>

<blockquote><literallayout>&lt;chapter id="ChapterIX"> ...
&lt;/chapter></literallayout></blockquote>

<para>The reader should take care to observe the "id" in the above
example is the attribute name - not its type.  It is the
<emphasis>type</emphasis> 
of the attribute which must be declared to an "ID" for the attribute
to be recognized as a link destination.  The only way the parser can know 
that an attribute value is of an ID type is by reading the attribute 
definition for the element.  For an SGML document or an XML documents 
with a DTD this information will be gotten by DocZilla from the DTD.  In 
the case of an XML document without a DTD it is possible to declare ID 
attributes in the internal subset without having a full DTD or even element 
definitions.  For example:</para>

<blockquote><literallayout>&lt;!DOCTYPE book [
&lt;!ATTLIST chapter id ID #IMPLIED> ]>
</literallayout></blockquote>

<para>is sufficient to enable the parser to recognize the id attribute
on chapter elements as ID types.</para>
</sect2>

<sect2 id="cont1"><title>IDREF Links</title>

<para idref="dest1">This entire paragraph is an example of an
IDREF to ID Link.  An attribute declared to be an IDREF type has a
value of "dest1".  When you click anywhere on this paragraph you
will jump to element which has an attribute of type ID with a
value of "dest1".  Go ahead and do this now.</para>

<para>The markup for the para element above with the IDREF attribute
to "dest1" looks like this:</para>

<blockquote><literallayout>&lt;para idref="dest1">This ...
now.&lt;/para></literallayout></blockquote>

<para>Like ID attributes, IDREF attributes must be declared
in an attribute definition to be recognized as link sources.  Here is
an example of attribute definition for para with an IDREF declaration:</para>

<blockquote><literallayout>&lt;!ATTLIST para idref IDREF
#IMPLIED></literallayout></blockquote>

<para>The style of the link source paragraph above (red text, underlined,
pointer-type cursor)
is accomplished with a Cascading Style Sheet (CSS) Level 2 rule with
a selector for the attribute idref.  The following rule causes
<emphasis>any</emphasis>
element with an attribute named idref to be so styled:</para>

<blockquote><literallayout>*[idref] {
    text-decoration: underline;
    color: blue;
    cursor: pointer;
}
</literallayout></blockquote>

<para>IDREF links can not be used to link to URLs or external files.  Many
validating SGML or XML parsers will report when an IDREF does not have a
matching ID
in a file.  DocZilla simply ignores IDREF links which cannot be resolved.
IDREF
links always are "replace": that is, the current browser window is positioned
over the link target, replacing the link source position.</para>
</sect2>

<sect2><title>HyTime NAMELOC Links</title>

<para>Named Locations provide redirection of link targets.  IDREFs point
at the ID of a Named Location (NAMELOC) which contains the ultimate
target of the link in an NMLIST.  The NAMELOC can occur anywhere in the
document.  It is possible to used Named Locations to group all link
destinations in one place in the document where link targets can be
easily maintained.  Another advantage of NAMELOC is that NMLISTs can
refer to external files.  Perhaps the most important advantage of
NAMELOC is that can be used to implement out-of-line links where
link targets are kept in an external intermediary document, for example,
where a CD-ROM program refers to a file on the Web for the most
up-to-date Web-based links.</para>

<para>NAMELOC is from HyTime, an ISO standard related to SGML.</para>

</sect2>
<sect2>
<title>HyTime clinks with ENTITY type linkends</title>
<para>Here is a HyTime clink whose linkend attribute type is ENTITY and
the target document is <extref linkend="target">target.sgm</extref></para>
<para>Here is a HyTime clink whose linkend attribute type is ENTITY and
the target is <extref linkend="target-id1">target.sgm</extref>. Note that
the system identifier for this entity contains XPointer IDLoc 
(shorthand notation) so we will scroll to id1 in the target document.</para>

</sect2>
<sect2 id="section1">
<title>Internal HyTime clinks with nameloc</title>
<para>Here is a link to <clink linkend="id1">id1</clink>.</para>
<para>Here is a link to <clink linkend="nameloc1">id1
<nameloc id="nameloc1">
<nmlist>id1</nmlist>
</nameloc>
</clink> via nameloc.</para>
<para>Here is a link to <clink linkend="nameloc1">id1
<nameloc id="nameloc4">
<nmlist>nameloc1</nmlist>
</nameloc>
</clink> via 2 namelocs (nameloc4 -&gt; nameloc1).</para>
</sect2>
<sect2>
<title>External HyTime clinks with nameloc</title>
<para>Here is a link to <clink linkend="nameloc5">target.sgm
<nameloc id="nameloc5">
<nmlist nametype="entity">target</nmlist>
</nameloc></clink>
</para>
<para>Here is a link to <clink linkend="nameloc6">id1 in target.sgm
<nameloc id="nameloc6">
<nmlist docorsub="target">id1</nmlist>
</nameloc></clink>.
</para>
<para>Here is a link to <clink linkend="nameloc12">middle.sgm nameloc1
<nameloc id="nameloc12">
<nmlist docorsub="middle">nameloc1</nmlist>
</nameloc></clink>
from where we jump to somewhere else. After you try this once, you can edit
the middle.sgm file so that the the location points to file target2.sgm. Once
you do that change, this link here will go to another location than it
initially
did. This simulates the situation where this document sits on a CD-ROM for
example,
but you can still change where the link points to.
</para>

</sect2>

<sect2>
<title>Internal HyTime clinks with treeloc - linking to elements without an
ID</title>

<para>Here is a link that  
<clink linkend="treeloc1">first locates element with ID doc1 (the root
element), then the
second child of that (chapter) and the second child of that (sect1) and the
first child of it (para)</clink>
which begins "DocZilla currently supports".
<treeloc id="treeloc1" locsrc="doc1">
<marklist>1 2 2 2</marklist>
</treeloc>
</para>

</sect2>

<sect2>
<title>HyTime queryloc</title>
<para>HyTime queryloc lets you employ non-HyTime links. First, you define a
NOTATION for
the link type. Then you must have a module that understands your notation
and plug
that into the HyTime engine. DocZilla will have such a pluggable interface
for third-party
developers to create their own queryloc handlers. Currently we have tested
this and created
a notation handler for the HTML URL type link.</para>
<para>With the help of HyNames attribute renamer attribute and queryloc we
created an element called
"a" whose usage is exactly like the HTML A element.</para>
<para>Here is a HyTime <a href="#id2">queryloc</a> clink using URL notation
to id2.</para>
<para>Here is a HyTime <a href="target.sgm">queryloc</a> clink using URL
notation to target.sgm.</para>
<para>Here is a HyTime <a href="http://www.doczilla.com">queryloc</a> clink
using URL notation to 
DocZilla web page.</para>
</sect2>
<sect2>
<title>Simple XLink</title>
<para>Here is a <simple xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple"
xlink:show="replace" xlink:actuate="onRequest"
xlink:href="http://www.doczilla.com">simple XLink</simple> to DocZilla web
site.</para>
</sect2>
<sect2>
<title>Inter-document Link Targets</title>
<para id="id1">id1</para>
<para>.</para>
<para>.</para>
<para>.</para>
<para>.</para>
<para>.</para>
<para id="id2">id2</para>
<para>.</para>
<para>.</para>
<para>.</para>
<para>.</para>
<para>.</para>
<para>.</para>
<para>.</para>
<para>.</para>
<para>.</para>
<para>.</para>
<para>.</para>
<para>.</para>
<para>.</para>
<para>.</para>
<para>.</para>
<para>.</para>
<para>.</para>
<para>.</para>
<para>.</para>
<para>.</para>
<para>.</para>
<para>.</para>
<para>.</para>
<para>.</para>
<para>.</para>
<para>.</para>
<para>.</para>
<para>.</para>
<para>.</para>
<para>.</para>
<para>.</para>
<para>.</para>
<para>.</para>
<para>.</para>
</sect2>
</sect1>
<sect1><title>Some targets</title>
<para id="dest1">Congratulations - you've reached the first link destination.
The markup for this paragraph looks like this:</para>
<blockquote><literallayout>&lt;para id="dest1">Congratulations ...
this:&lt;/para></literallayout></blockquote>
<para idref="cont1">Click here to go back to the section on IDREF to ID
links.</para>
</sect1>
</chapter>
</doc>
