Re: What about an <INSERT HREF="foo.txt"> tag ?

Ka-Ping Yee (s-ping@orange.cv.tottori-u.ac.jp)
Thu, 13 Jun 1996 18:21:27 +0900


Message-Id: <31BFDD97.10D0AE22@sse.tottori-u.ac.jp>
Date: Thu, 13 Jun 1996 18:21:27 +0900
From: Ka-Ping Yee <s-ping@orange.cv.tottori-u.ac.jp>
To: Wolfgang HEES <hees@lhc.msm.cern.ch>
Cc: www-html@w3.org
Subject: Re: What about an <INSERT HREF="foo.txt"> tag ?

Wolfgang HEES wrote:
> 
> Hi,
> 
> was there ever the idea of creating an <INSERT HREF="foo.txt"> tag ?
> It would take the contents of the specified file (be it HTML or not)
> and display it in the page.

Dozens upon dozens of times.  This has got to be the most
requested and proposed HTML idea, i think.  There are two
kinds of inclusion i see as useful: (a) inserting an entire
document as a figure, and (b) including pieces of HTML as part
of the current document.

(a) The FIG tag would have supported putting another entire HTML
document in a box, and the OBJECT tag should work fine for
this purpose, too.  That is, as long as browser makers decide
to implement rendering for "text/html" embedded objects.

(b) As for directly including HTML as part of your document, i
proposed a method for HTML inclusion (quite a while ago) on the
HTML mailing lists, and haven't had the time and energy to
hype it up enough or try it out.  So discussion faded away,
but i still think the idea is sound.  Here i go...

---
(proposal:)

Instead of introducing a new tag, put a SRC attribute on a
couple of other text-structure tags.  Like, say, <P> and <DIV>.

Then in your parent document(s) put

    <DIV SRC="inclusion.html#toolbar">[inclusion failed]</DIV>

and in your included document(s) put

    <DIV ID="toolbar">
    <A HREF="/index.html"><IMG SRC="foo" ALT="home"></A>
    ... whatever ...
    ... whatever ...
    ... whatever ...
    </DIV>

(In HTML 3, every element should be ID'able, which makes life
much easier for people who want to make fragment links.  Of
course, Netscape still hasn't gotten around to implementing
this simple but really useful attribute.)

---
(rationale:)

Many HTML and SGML folks think direct inclusion is a really
bad idea because it puts unknown structure into the document,
making its validness indeterminate.  You might even have an
invalid document include another invalid document to produce
a suddenly valid document, for instance!  (Or a whole bunch
of other confusing possibilities.)  Imagine what would happen
if the included document were just

    <H1>

This is very troublesome because the viewer might not choose
to perform the inclusion, or the included document may be
inaccessible, or might be owned by someone else.

The solution above neatly avoids this problem, because you
don't include *documents*, you include *fragments*.  You point
out a specific piece to include out of the document you
include from.  If the thing you declare in the parent and
the thing you include have the same (or compatible) structure,
you can be sure that everything will be valid, with or without
doing the inclusion, as long as the parent and included
documents are okay.

This is also more efficient.  You can put a whole bunch of
fragments in one document -- so when they are loaded and
cached by the browser, you don't have to make a new connection
for each inclusion.  Even better, you can do the inclusion off
of a "real" page just by marking what's there.  For instance,
if you just put a real copy of your toolbar on your company's
main, top-level page, and have all the other documents refer
to it with

    <DIV SRC="/index.html#toolbar"></DIV>

or whatever, then people who happen to visit your top-level
page first will suffer *no extra cost* whatsoever for doing
the inclusions.


Thoughts and comments are much appreciated!


Ping