next up previous
Next: Specific Structures Up: Predicates for Generating HTML Documents Previous: Predicates for Generating HTML Documents

General Structures

 

Basically, HTML has two kinds of components: HTML elements and HTML environments. An HTML element has the form <NAME Attributes > were NAME is the name of the element and Attributes is a (possibly empty) sequence of attributes, each of them being either an attribute name or an attribute assignment as name="Value".

An HTML environment has the form <NAME Attributes > Text </NAME> were NAME is the name of the environment an Attributes has the same form as before.

The general Prolog structures that represent these two HTML constructions are:

Name$Atts
(This is a `$' binary operator.) Represents an HTML element of name Name and attributes Atts, were Atts is a (possibly empty) list of attributes, each of them being either an atom or an structure name=value. For example, the term
img$[src='images/map.gif',alt='A map',ismap]
is translated into the HTML source
<img src="images/map.gif" alt="A map" ismap>
Note that HTML is not case-sensitive, so we can use lower-case atoms.
name(Text)
(This is a term with functor name/1 and argument Text) Represents an HTML environment of name name and included text Text. For example, the term
address('clip@dia.fi.upm.es')
is translated into the HTML source
<address>clip@dia.fi.upm.es</address>
name(Atts,Text)
(This is a term with functor name/2 and arguments Atts and Text) Represents an HTML environment of name name, attributes Atts and included text Text. For example, the term
a([href='http://www.clip.dia.fi.upm.es/'],'Clip home')
represents the HTML source
<a href="http://www.clip.dia.fi.upm.es/">Clip home</a>

In principle, (almost) any HTML construction can be represented with these structuresgif, but for the sake of simplifying HTML creation, more specific structures were designed.



Mon Mar 18 21:38:39 MET 1996 <clip@dia.fi.upm.es>