XML templates, nomenclature and DTDs

One of the most needed feature of XML concerns the lack of a common DTD to be used as a basic template system for building XML documents. At the time of this post, only DocBook provides such an alternative, though its DTD is not recognized by any browser, so that it simply doesn't exist a default stylesheet used to display a DocBook document (as it happens to MathML). This point is particularly interesting, because many developers have yet noticed that most of the new elements of HTML 5 owe something to the DocBook DTD. So the question is: what should we do?

The first (and most feasible) option is to use XSLT for transforming an XML document into an HTML document, stylize it and display it on a web browser. So far so good. Anyway, this is a more time-consuming approach, because it involves 1) the XML document source 2) the XSLT stylesheet 3) the HTML transformation 4) the CSS styles 5) the final rendering on a web browser. Instead, if we had a common DTD and the resulting shared template system, we'd only need three steps (1, 4, 5).

The second option, that I'd like to propose, is the usage of common naming conventions in order to build a shared XML template system. That is, this is exactly the same thing proposed for CSS by Andy Clarke in his book Transcending CSS. In a nutshell, if web developers used a common nomenclature for certain XML elements, we could build up a shared XML template system that might be reused in many different scenarios, for example with remote services processing or Ajax. This would reduce the likelihood of inconsistencies during the parsing and processing of XML documents. Further, we might even be able to write a shared CSS file used for the rendering of such common elements. Is this utopia? Time will tell.

Leave a Reply

Note: Only a member of this blog may post a comment.