Click here to get back home

[x]html head semantics question

 HomeNewsGroups | Search | About
 comp.infosystems.www.authoring.html    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
[x]html head semantics question Jon Fairbairn 11-06-2007
Posted by Jon Fairbairn on November 6, 2007, 10:50 am
Please log in for more thread options

How does the order of title, base and other elements in the
head of a document affect meaning?

I'm working on a Haskell library of combinators to produce
html (currently xhtml1-strict, as that's a little easier),
that ensures confomance to the dtd by typechecking at
compile time. For the most part, the combinators hide the
internal datastructure, reducing clutter.

One part of the DTD is causing me pain.
<!ELEMENT head (%head.misc;,
((title, %head.misc;, (base, %head.misc;)?) |
(base, %head.misc;, (title, %head.misc;))))>

which is a sequence of %head.misc elements with exactly one
title and at most one base interposed. Obviously from a
human author of xhtml's point of view the flexibility in
order is valuable, but a datastructure that represents the
whole flexibility is unwieldy. If I could fix the order to
be say: %head.misc;, (base)?, title, or title, (base)?,
head.misc; the mandatory aspect of the presence of title
would be less onerous to the eventual user.

I'm aware that for example, head elements specifying charset
might need to appear before title (though that's academic as
the generated html uses character entity references for
anything outside ASCII). Is there anything that cannot be
expressed if the title is forced to appear at the end?

--
Jón Fairbairn Jon.Fairbairn@cl.cam.ac.uk


Posted by Chris Morris on November 6, 2007, 11:32 am
Please log in for more thread options
> How does the order of title, base and other elements in the
> head of a document affect meaning?

Very little, for elements of different types - I'm not aware of any
issues there. Elements of the same type, there can be an ordering issue
(e.g. stylesheets and selectors with the same specificity)

> whole flexibility is unwieldy. If I could fix the order to
> be say: %head.misc;, (base)?, title, or title, (base)?,
> head.misc; the mandatory aspect of the presence of title
> would be less onerous to the eventual user.

I'd say that it'd be easier - given that the <head> element doesn't
have much variety in it - to represent <head> with a different data
type to those used for the sub-elements of <body>.

My structure for developing HTML documents programmatically (not in
Haskell, but I think it would work there in a similar way) is:

Document
-> Doctype
-> HTTP headers
-> Head
-> Title
-> Metadata (key-value Dict for <meta>)
-> [Links] (<link rel="anything other than stylesheet">)
-> [Stylesheets]
-> [Scripts]
-> Body
-> Tree of elements (HTML and anonymous)

While the 'Body' is a proper tree representation of the HTML (with
constraints), I didn't see the point of doing the same for the Head
(or the small amount of the output document that isn't in either), so
'show Document' just prints out the document and head in that fixed
order before recursively printing the body.

The ones using lists are (or at least could be) sensitive to the order
they appear. The Metadata might be - but probably not consistently
between user-agents - if I allowed multiple ones with the same key, so
I don't. I miss out <base> entirely just because I've not needed it
(and no-one else has asked for it). I expect I'll add it at some
point.

--
Chris

Posted by Andy Dingley on November 6, 2007, 12:48 pm
Please log in for more thread options
> How does the order of title, base and other elements in the
> head of a document affect meaning?

Absolutely none. Generate in any order you like. For a user agent to
require any particular order would be wrong.

In practice, both of these are observed.

> I'm aware that for example, head elements specifying charset
> might need to appear before title

Agreed. Andreas merely has an obsession with this. I'm sure that
people coding in Haskell don't need to be reminded.


Similar ThreadsPosted
Questions about XHTML Content May 19, 2005, 9:49 am
Markup with semantics in mind June 14, 2006, 12:55 am
Semantics: Program & File Names? June 24, 2007, 7:35 pm
Strict XHTML and div question July 14, 2005, 7:07 pm
Question about structure of XHTML May 26, 2007, 11:23 pm
XHTML standard rationale question February 13, 2005, 7:32 pm
XHTML Doctype question and THANKS to the group. December 15, 2005, 11:53 pm
style=& ? November 22, 2004, 7:24 am
How to use script in ? October 14, 2006, 7:51 pm
Including a xml file into the HEAD tag September 18, 2007, 5:09 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap