Re: Future of HTML

Frank Boumphrey (bckman@ix.netcom.com)
Sat, 21 Mar 1998 23:33:09 -0800


From: "Frank Boumphrey" <bckman@ix.netcom.com>
To: "XSL STYLE LIST" <xsl-list@mulberrytech.com>,
Date: Sat, 21 Mar 1998 23:33:09 -0800
Message-ID: <01bd5564$c2fa0e20$b9acdccf@uspppBckman>
Subject: Re: Future of HTML

This is a multi-part message in MIME format.

------=_NextPart_000_000C_01BD5521.B4D6CE20
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

    The following is offered as a very "quick and dirty" demonstration of
the <XMLDOC> tag and an <XSTYLE> style sheet in my proposal. It uses the IE4
version of the DOM so it will not run on Navigator, and I have only tested
it on a PC, but it should work on any platform with an IE browser.

    There is an alert which shows the HTM code generated, comment out all
references to htmstring to get rid of it.

    It employs the "cheat" of enclosing an <XMLDOC> tag within a <DIV> tag
with its id set to "xml".

    It is meant as a demonstration of how easy this wrapper would be to
implement.  the .js file is here as attachment js2.js, the htm file is also
atttached as js1.htm

    I have also posted this to the css and the XSL list in case it is of any
interest.

    Frank Boumphrey
ps. written in strict emacs
<HTML>
<HEAD>
<TITLE>Demonstration of XMLDOC tag</TITLE>
<STYLE>
</STYLE>
</HEAD>
<BODY>
<DIV id=xml style="display:none;">
 <XMLDOC>
 <XSTYLE>
 document{font-size:8pt;color:green;}
 greeting{
  color:red;
  font-size:18pt;
  display:block;
 }
 insult{
  color:teal;
  font-size:28pt;
  display:block;
 }
 emphasis{
  color:black;
  font-size:38pt;
  display:inline;
 }
 </XSTYLE>
 <document>Some extraneous text
  <greeting voice="nice">Hello world</greeting>
  <greeting>hello xmldoc tag</greeting>more extraneous text
  <insult>Hiss off you <emphasis>stupid<extraem>stupid</extraem></emphasis>
old fool </insult>
  more extraneous text
  <!--a comment-->
 </document>
 </XMLDOC>
</DIV>
<SCRIPT SRC="js2.js">
</SCRIPT>
<SCRIPT>
//this script must be placed after the XML document.
 var tagnames=new Array();

 for (i=0;i<=xml.all.length-1;i++)
  {
  tagnames[i]=xml.all[i].tagName;

  }
 printarray(tagnames,xml.innerHTML);

</SCRIPT>
</BODY>
</HTML>
-----Original Message-----
From: Frank Boumphrey <bckman@ix.netcom.com>
To: www-html@w3.org <www-html@w3.org>
Date: Friday, March 20, 1998 1:27 PM
Subject: Future of HTML


>         Future of HTML
>
>             Proposer contact: bckman@ix.netcom.com
>                     Name: Frank Boumphrey
>                       Tel:  440-338-3302
>
>
>                  Proposal for an XML wrapper
>  ------------------------------
>
>Introduction
>------------
>     As authors and businesses and web authors move over to XML based data
>bases and
>documents there is going to be a need to embed XML documents in existing
>HTML documents.
>     This proposal discusses achieving this through a wrapper <XMLDOC>, and
>discusses
>supporting attributes and Tags to service the primary tag.
>     In XML a tag beginning with the sequence XML is not allowed as these
>tags are reserved.
>XMLDOC however is not an XML tag it is an HTML tag.
>
>
>    Basic considerations and presumptions.
>    --------------------------------------
>     The following issues will need to be considered.
>
>     1.There will be a need for HTML documents to display XML documents as
>inclusions in
>their flow.
>
>     2.The contents of the XML document may either be known to the HTML
>document
>before hand (as when the XML is authored concurrently with the HTML
>document), or the XML
>content may be unknown to the HTML author (as when the XML document is
>imported). In the
>first case it may be beneficial for the XML elements to inherit the style
>properties of the parent
>HTML document (e.g. via. Inheritance from the parent style properties or ID
>and CLASS
>attributes), in the second case the XML content should probably be "hidden"
>from the parent
>document.
>
>     3.The XML document may need to be displayed, or it may act as a
>resource for a client-
>side script to manipulate ( as when the XML document acts as data source).
>
>     4.With the above in mind the XML wrapper should have provision for
>providing default
>display, associating the XML content with style sheets, and associating the
>XML document with
>scripts.
>
>     5.The XML document in its wrapper should have the ability to import
>style sheets, scripts,
>entities, and other XML documents.
>
>     6.There may be more than one XML document within the HTML containing
>document.
>There should therefore be provision for a single external XML style sheet
>and/or script to handle
>all these documents.
>
>     7.It should be easy to author active-X components or plug-ins to work
>in conjunction with
>the current browsers. Note that the issue of using an XML wrapper is quite
>different from using
>an XML compliant browser.
>
>     8. Any special attributes should be completely compatible with and
>leverage the ongoing
>W3 work on CSS and the Document Object Model.
>
>     9. Any tags should be forward-ly compatible to easily meet future
>demands
>
>Default Behavior
>----------------
>     In the absence of any attributes being set on the XMLPROC tag, each
>child tag should be
>ignored and the content treated as a inline flow object inheriting the
>parent styling. This is in fact
>the way that the current mainline browsers should (and do) treat the
><XMLDOC> tag or any
>unknown tag
>
>
>The XMLDOC tag and the HTML flow structure
>-------------------------------------------
>It is an open question whether the descendant tags in the XML document
>should enter into the
>HTML DOM or whether they should form their own tree. If they form part of
>the HTML DOM
>then they can be operated on by Script outside of the XML doc tag.
>     If the content attribute (see below) is set to visible, then they
>should probably be exposed
>to the whole document, if set to hidden then they should probably be kept
>completely self
>contained.
>
>
>Attributes
>------------
>     The following is a possible list of attributes (Modified EBNS syntax)
>
>     Content (Hidden|Visible) "hidden"
>
>     If set to hidden then the XML document is shielded from the rest of
the
>HTML
>document. This means that outside scripts, style sheets etc. will have no
>effect on the document.It
>is even possible that an id value in the xml document may be the same as an
>id value in the HTML
>document.
>     The default value should be hidden
>
>
>     src <url>|none
>
>     Can be used to import an XML document into the wrapper. To prevent
>problems
>with well formed-ness only one XML document per XMLDOC element should be
>allowed. This
>should not prevent the importation of entities. See <XPROLOG> below.
>
>     render (visible|hidden|partial) "visible"
>
>     To be distinguished from content, and similar to the CSS visibility
>property which
>cold be used instead. A value of partial would allow display of some of the
>element content by a
>mechanism yet to be determined.
>
>     importstylesheet [[url],]*.
>
>     Several style sheets can be imported and a cascade would be allowed.
>The first in a
>tokenized list of URL's would be the first to be imported. These style
>sheets would be invisible to
>the rest of the HTML document and would be encased in an <XSTYLE> tag
>
>     ImportScript [[url],]*
>
>     The same considerations would be applied to imported Scripts.
>
>     string [[<cdata>],]*
>
>     In keeping with XML this attribute could take one or several strings.
>
>     plus id, class, style, name, dir, and lang
>
>     If  the value of content is hidden then no styling will be passed to
>the XML content
>by default. However if the XMLDOC has its class set to a style then that
>style can be passed to
>the contents. The same if style is specified by way of an inline tag.
>
>
>Contained special tags
>----------------------
>
>     The following tags can be employed inside the <XMLDOC> element. They
>should appear
>where the PROLOG would normally appear, at the head of the document. In
>other words they would not enter in to the well formedness of the document.
>
>      XPROLOG
>
>     The main value of the XPROLOG would be to contain entities and
possibly
>notation declarations. It is doubtful that there would be any need to use a
>DTD for validation in a document
>contained in an HTML document.
>
>     XLINK
>     XSCRIPT
>     XSTYLE
>
>     The above would act in just the same way as their HTML counterparts,
>but they would be
>accessible only to the contained document.
>
>     @import
>
>     As in CSS this can be contained in an XSTYLE wrapper to import further
>style sheets.
>
>ExternalTags
>------------
><XMLPROLOG>
>     <STYLE TYPE= "text/css">
>     </STYLE>
>     <SCRIPT>
>     </SCRIPT>
>
></XMLPROLOG>
>
>     A further container at the head of the HTML document could contain
>elements that would
>only apply to contents of the XMLDOC wrappers.
>
>
>Linking
>-----------
>
>     Simple linking from within the container should be supported.
>
>
>User agent behavior
>-------------------
>    The following is a list of behaviors that user agent, s might support.
>
>     1.At a minimum the user-agent should keep a record of the whole
>content, tags and all.
>This will allow parsing by scripts.
>
>     2.The user-agent should expand any entities in XMLDOC before passing
>them on to
>DOM.
>
>     3.The user agent should keep an array of the children tags and their
>content
>
>     4.The user-agent should be able to re-flow in response to actively
>generated flow objects.
>
>     5.The user agent will need to recognize that XML tags are case
>sensitive, when it makes
>itscollections for the DOM
>
>     6.The user agent will need to recognise PI's and notation declarations
>even if in cannot act
>on them.
>
>
>    Respectfully submitted,
>
>        Frank Boumphrey.
>
>

------=_NextPart_000_000C_01BD5521.B4D6CE20
Content-Type: text/html;
	name="js1.htm"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="js1.htm"

<HTML>
<HEAD>

<TITLE>Demonstration of XMLDOC tag</TITLE>

<STYLE>
</STYLE>

</HEAD>
<BODY>
<DIV id=3Dxml style=3D"display:none;">
	<XMLDOC>
	<XSTYLE>
	document{font-size:8pt;color:green;}
	greeting{
		color:red;
		font-size:18pt;
		display:block;
	}
	insult{
		color:teal;
		font-size:28pt;
		display:block;
	}
	emphasis{
		color:black;
		font-size:38pt;
		display:inline;
	}
	</XSTYLE>
	<document>Some extraneous text
		<greeting voice=3D"nice">Hello world</greeting>
		<greeting>hello xmldoc tag</greeting>more extraneous text
		<insult>Hiss off you =
<emphasis>stupid<extraem>stupid</extraem></emphasis> old fool </insult>
		more extraneous text
		<!--a comment-->
	</document>
	</XMLDOC>
</DIV>
<SCRIPT SRC=3D"js2.js">
</SCRIPT>
<SCRIPT>
//this script must be placed after the XML document.
	var tagnames=3Dnew Array();
=09
	for (i=3D0;i<=3Dxml.all.length-1;i++)
		{
		tagnames[i]=3Dxml.all[i].tagName;
	=09
		}
	printarray(tagnames,xml.innerHTML);
=09
</SCRIPT>

</BODY>
</HTML>
------=_NextPart_000_000C_01BD5521.B4D6CE20
Content-Type: application/x-javascript;
	name="js2.js"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="js2.js"


//This script makes use of the IE4 document object model, it will not =
work on Navigator.


//////////////////////////////FRANK =
BOUMPHREY/////////////////////////////////////////////
//Written by Frank Boumphrey bckman@ix.netcom.com. March 21 1998. =
Comments welcome. 	//
//This code is placed in the public domain and may be freely copied and =
distributed,	//=20
//but I would be grateful if you left this header in place. 				//
//////////////////////////////FRANK =
BOUMPHREY/////////////////////////////////////////////


var htmstring=3D"\t\tGENERATED HTML CODE:----\n"


function printarray(e,f)

	// begin function
	// e should be an array of all the XML tag names from <DIV id=3Dxml>
	// f should be all the XML text taken from innerHTML

	{
	=09
	var remtext=3Df
	var el_text=3D""
	var tagstack=3D0
	var stylesheet=3DgetXstyle(f)

		//alert(stylesheet)
		//document.write("<DIV STYLE=3D'color:red'>")
		//loop through the tags, exclude</XMLDOC>

		for(var i=3D0;i<=3De.length-2;i++)
			{		=09
		=09
			el_text=3D(trimText(getText(e[i],e[i+1],remtext)));	//the text =
between the tags
	=09
			remtext=3Dremtext.substring(remtext.indexOf(e[i+1]));	//advance the =
text

			if (gettagtype(e[i])=3D=3D0 && e[i].charAt(0)!=3D"X")		//ignore or =
wrapper
				{tagstack++}					//add to stack if opening tag
			else if(gettagtype(e[i])=3D=3D1 && e[i].substring(0,2)!=3D"/X")
				{tagstack--}					//take off stack if closing tag

			if(e[i].charAt(0)!=3D"X")
				{
		=09
				if(gettagtype(e[i])=3D=3D0)			=09
					{			=09
					makeFlowobject(e[i],el_text,stylesheet);
					}

				else if(tagstack=3D=3D0 && gettagtype(e[i])=3D=3D1 && =
e[i].substring(0,2)!=3D"/X")	//exclude special tags
					{			=09
					makeFlowobject(e[i],el_text,stylesheet);
					}
				else if(tagstack >0 && gettagtype(e[i])=3D=3D1 && =
e[i].substring(0,2)!=3D"/X")	//print the text
					{=09
						//var this	=09
					makeFlowobject(e[i],el_text,stylesheet);
					document.write(el_text);
					}
				}
		}
	alert(htmstring)
	}

////////////////////////////
//end function printarray//
///////////////////////////

function gettagtype(e)

	//cannot at present identify empty tag as in text / is not returned.=20
	//Will need another routine to do this, probably identify from =
innerHTML
	//opening tag=3D0,closing tag=3D1,emptytag=3D2,comment=3D3
	{
=09
	var tagtype=3D0
	if (e.charAt(0)=3D=3D"/")
		{tagtype=3D1}
	else if (e.charAt(0)=3D=3D"!")
		{tagtype=3D3}
	else tagtype=3D0
	return tagtype
	}

////////////////////////////
//end function gettagtype//
///////////////////////////

/*-------------------------------------------------BEGIN REMOVED

function areTagsSameType(e,f)

	//e is present tag,f is next tag

	{
	var sametype=3Dtrue
	if(f.substring(1)=3D=3De)
		{sametype=3Dtrue}
	else sametype=3Dfalse
	//return true or false
	return sametype
	}

////////////////////////////////
//end function areTagsSameType//
////////////////////////////////
-------------------------------------------------END REMOVED*/

function getText(e,f,g)

//e is present tag,f is next tag,g is the remnant text
//returns the text between two tags

	{
	var Uppertext=3Dg.toUpperCase()

	var endindex=3DUppertext.indexOf(f,e.length)
	var el_text=3Dg.substring(e.length+1,endindex-1)
	return el_text
	}

////////////////////////
//end function getText//
////////////////////////

function trimText(e)
//e is text to trim
//removes all text to the left of > and returns the edited string
=09
	{
	var textstr=3De;
	var startnum=3De.indexOf(">",0);
	textstr=3De.substring(startnum+1);
	return textstr;
	}
/////////////////////////
//end function trimText//
/////////////////////////

//--------------------------------------------BEGIN REMOVED
/*
function getStylingtag(e,f)

// e is opening tag,f is closing tag.
//adds the appropiate style to the text and prints it.

//check to see what type the closing tag is, if it is the same type then =
return the opening tag
//if it is another opening tag then just apply the style.
//if it is a different tag and a closing tag, apply the style of the =
closing tag
	{
	if(areTagsSameType(e,f)=3D=3Dtrue)
		{return e;}
	else if(gettagtype(f)=3D=3D0)
		{return e;}
	else {return f.substring(1);}
	}
//////////////////////////////
//end function getStylingtag//
/////////////////////////////
//--------------------------------------------END REMOVED*/


function makeFlowobject(e,f,g)

//Get type of tag if opening styleit ,if closing close it with =
appropiate DIV or SPAN
//Will need to link with style sheet of <XSTYLE> TYPE
//e is the tag, f the text to style, g the style sheet
=09
=09
	{
=09
	//htmstring=3Dhtmstring+"A"
	//alert(htmstring)

	e=3De.toLowerCase();		//IE4 DOM represents all tags in upper case.
	if(gettagtype(e)=3D=3D0)
		{=20
		if (g.indexOf(e,0)!=3D-1)
			{
		=09
			var ss=3DgetStyleString(e,g);
			//alert(ss)
			if(ss.indexOf("display:block",0)!=3D-1)
				{
				document.write("<DIV STYLE=3D'"+ss+"'>"+f)
				htmstring=3Dhtmstring+"<DIV STYLE=3D'"+ss+"'>"+f
				}
			else
				{
				document.write("<SPAN STYLE=3D'"+ss+"'>"+f)
				htmstring=3Dhtmstring+"<SPAN STYLE=3D'"+ss+"'>"+f
				}
			}
		else if(e=3D=3D"greeting")
			{
			document.write("<DIV STYLE=3D'color:red'>"+f)
			//alert("<DIV STYLE=3D'color:red'>"+f)
			}
		else if(e=3D=3D"insult")
			{
			document.write("<DIV STYLE=3D'color:blue'>"+f)
			//alert("<DIV STYLE=3D'color:blue'>"+f)
			}
		else if	(e=3D=3D"emphasis")
			{
			document.write("<SPAN STYLE=3D'color:green'>"+f)
			//alert("<SPAN STYLE=3D'color:red'>"+f)
			}
		else	{
			document.write("<SPAN STYLE=3D'color:yellow'>"+f)
			htmstring=3Dhtmstring+"<SPAN STYLE=3D'color:yellow'>"+f
			//alert("<SPAN STYLE=3D'color:red'>"+"S"+f)
			}
		}
	else if(gettagtype(e)=3D=3D1)
=09
		{
		e=3De.substring(1)
		//alert(e)
		if (g.indexOf(e,0)!=3D-1)
			{
			var ss=3DgetStyleString(e,g);
		=09
			if(ss.indexOf("display:block",0)!=3D-1)
				{
				document.write("</DIV>")
				htmstring=3Dhtmstring+"</DIV>"
				}
			else
				{
				document.write("</SPAN>")
				htmstring=3Dhtmstring+"</SPAN>"
				}
			}
		else if(e=3D=3D"greeting")
			{
			document.write("</DIV>")
			//alert(e+"</DIV>")
			}
		else if(e=3D=3D"insult")
			{
			document.write("</DIV>")
			//alert(e+"<DIV>")
			}
	=09
		else if(e=3D=3D"emphasis")
			{
			document.write("</SPAN>")
			//alert(e+"<DIV>")
			}
		else	{
			document.write("</SPAN>")
			htmstring=3Dhtmstring+"</SPAN>"
			//alert(e+"</DIV>")
			}
		}

	//
	}


///////////////////////////////
//end function makeFlowobject//
///////////////////////////////


function getXstyle(e)

//gets the style sheet in innerHTMLand returns it as a string
//e should =3DinnerHTML
	{
	var beginnum=3De.indexOf("XSTYLE",0);
	//alert(beginnum)
	var endnum=3De.indexOf("/XSTYLE",0);
	//alert(endnum)
	var stylesheet=3D e.substring(beginnum+7,endnum-1);
	//alert(stylesheet)
	return stylesheet
=09
	}


//////////////////////////
//end function getXstyle//
//////////////////////////


function getStyleString(e,f)

//e is the tag in lowercase, f the style string
//returns the style string of the requested tag

	{
	var beginnum=3Df.indexOf(e,0)+e.length;
	var remstring=3Df.substring(beginnum);
	var endnum=3Dremstring.indexOf("}",0);
	var stylestring=3Dremstring.substring(1,endnum);
	//alert (stylestring);
	return stylestring;
	}

///////////////////////////////
//end function getStyleString//
///////////////////////////////

function displayHtml(e)
	{
	return
	}

//------------------------------------------------------
/*

//-----------------------------------------------------------------------=
--
//Note cannot use empty tags with this very primative first =
coding.Document must be well formed
//Need to add code to check for well formed ness before running.
//(Quick and dirty check,tagstack should =3D0 at end)

//sample XML document
//<DIV id=3Dxml style=3D"display:none;">
//	<XMLDOC>
//<XSTYLE>
//	document{font-size:8pt;color:green;}
//	greeting{
//		color:red;
//		font-size:18pt;
//		display:block;
//	}
//	insult{
//		color:teal;
//		font-size:28pt;
//		display:block;
//	}
//	emphasis{
//		color:black;
//		font-size:38pt;
//		display:inline;
//	}
//	</XSTYLE>
//
//=09
//		<greeting voice=3D"nice">Hello world</greeting>
//		<greeting>Hello XMLDOC tag</greeting>
//		<insult>Hiss off you =
<emphasis>stupid<extraem>stupid</extraem></emphasis> old fool!! =
</insult>
//	=09
//		<!--a comment-->
//	</XMLDOC>
//</DIV>
//<SCRIPT SRC=3D"js2.js">
//</SCRIPT>
//<SCRIPT>
//
//	var tagnames=3Dnew Array();
//=09
//	for (i=3D0;i<=3Dxml.all.length-1;i++)
//		{
//		tagnames[i]=3Dxml.all[i].tagName;
//	=09
//		}
//	printarray(tagnames,xml.innerHTML);
//=09
//</SCRIPT>*/



























































------=_NextPart_000_000C_01BD5521.B4D6CE20--