Forum OpenACS Development: Re: Moving to XHTML

Collapse
10: Re: Moving to XHTML (response to 9)
Posted by Tom Jackson on
My version of Mozilla Firefox gets the w3 home page with a meta tag 'http-equiv="Content-Type" content="text/html; charset=utf-8"'. It is hard to see, smashed up against the head tag. However, I think you must be correct: the page it is being sent as application/xhtml+xml, when I use wget, it is text/html. Moving the identical file to my server and sending it, Firefox detects it as text/html, the only difference must be the server headers.

So how to solve the problem of being able to serve both. Simply making an additional template for each page wouldn't work. Some markup is produced in the tcl pages, in procs, and some is in the data. Somehow all these sources which make up the page which gets sent to the user have to be in sync.

My own method is to try to separate data, code and templating, roughly model-view-controller, but markup is difficult to handle generally. One idea is to have a data model which resembles RDF and to be able to apply templating to tiny chunks of code to create markup. As long as the two remain separate and allow for switching out the template, many different opportunities for reuse will open up. The RDF type model would allow the possibility of browsing the elements which were used to create a web page. (A simple html browser, or something using more complex, but either could operate on such a page just by using a different template. That is, the editor/browser would use the same technology on an expanded scale.) The RDF type linking between objects provides the semantic hints needed to pull this off.