HTML tags for XML markup


In response to Hugh McGuire's question I wanted to write something a bit longer than a tweet, since there are a number reasons why, although Hugh's suggestion makes absolute sense, and I agree that in the main we should save ourselves brain energy and use HTML tags, it is another issue, as to whether or not we should make all XML documents valid HTML5. And there are a number of practical reasons for this.

What are these practical reasons?

  1. InDesign is a tedious bore when it comes to using attributes in XML tags, and so it's easier and quicker to use solely tag names, especially for mapping to styles
  2. Using HTML tags we are at the mercy of the W3C additions, deprecations and alterations
  3. HTML tags were not specifically written for books, for example there's no <ref> or <reference>, <note> or <footnote> and if we wanted to be even more pedantic the <figure> tag is not broken down into <illustration> and so on
  4. If we ignore for the moment the hype about HTML5 being a rich, semantic language, and given point 3, XML should be future-proof and provide data in the richest possible way. We shouldn't shoehorn XML into HTML if that will disadvantage it and reduce richness in future iterations of HTML, or other new presentational languages.
I am aware that custom tags are available in HTML5 to get around the listed omissions. There is, however, the problem that if we create a custom <note> tag, for example, to define an endnote in our book and then the W3C decides that <note> will be used for <footnote> then things get confusing, and situations arise where changes to the data are required.

While it would be delightful if all documents were straight HTML5 with no transformation required, the real-world use of XML with InDesign and the future-proofing of content often requires that publishers cannot follow this path.



Endorse on Coderwall

Comments